Changeset 14070
- Timestamp:
- 09/23/2024 07:25:15 AM (15 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/common/includes/wporg-sso/wp-plugin.php
r14018 r14070 90 90 add_action( 'profile_update', array( $this, 'record_last_password_change' ), 10, 3 ); 91 91 add_action( 'wp_set_password', array( $this, 'record_last_password_change_reset' ), 10, 3 ); 92 93 add_filter( 'auth_cookie_expiration', array( $this, 'auth_cookie_expiration' ), 10, 2 ); 92 94 93 95 add_action( 'login_form_logout', array( $this, 'login_form_logout' ) ); … … 843 845 844 846 /** 847 * Shorten the session timeout for users who haven't setup 2FA. 848 * 849 * Acts as if the user didn't check the remember-me box. 850 */ 851 public function auth_cookie_expiration( $expiration, $user_id ) { 852 $user = get_user_by( 'id', $user_id ); 853 854 if ( $user && user_should_2fa( $user ) && ! Two_Factor_Core::is_user_using_two_factor( $user_id ) ) { 855 $expiration = min( $expiration, 2 * DAY_IN_SECONDS ); 856 } 857 858 return $expiration; 859 } 860 861 /** 845 862 * Redirects the user to a "please enable 2fa" page after login. 846 863 */ … … 862 879 // If the user doesn't REQUIRE 2FA, only nag ever so often. 863 880 if ( ! user_requires_2fa( $user ) ) { 864 $nag_interval = WEEK_IN_SECONDS;881 $nag_interval = 2 * DAY_IN_SECONDS; 865 882 $last_nagged = (int) get_user_meta( $user->ID, 'last_2fa_nag', true ); 866 883 if ( $last_nagged && $last_nagged > ( time() - $nag_interval ) ) {
Note: See TracChangeset
for help on using the changeset viewer.