- code review;

This commit is contained in:
nikitasinelnikov
2021-03-03 17:55:12 +02:00
parent d6c382e9e9
commit 6e0a711f4b
3 changed files with 12 additions and 2 deletions
+4 -1
View File
@@ -623,7 +623,10 @@ if ( ! class_exists( 'um\core\Password' ) ) {
UM()->user()->password_changed();
// clear temporary data
update_user_meta( $user->ID, 'password_rst_attempts', 0 );
$attempts = (int) get_user_meta( $user->ID, 'password_rst_attempts', true );
if ( $attempts ) {
update_user_meta( $user->ID, 'password_rst_attempts', 0 );
}
$this->setcookie( $rp_cookie, false );
// logout
+6 -1
View File
@@ -165,7 +165,12 @@ add_action( 'um_on_login_before_redirect', 'um_store_lastlogin_timestamp', 10, 1
function um_store_lastlogin_timestamp_( $login ) {
$user = get_user_by( 'login', $login );
um_store_lastlogin_timestamp( $user->ID );
delete_user_meta( $user->ID, 'password_rst_attempts' );
$attempts = (int) get_user_meta( $user->ID, 'password_rst_attempts', true );
if ( $attempts ) {
//don't create meta but update if it's exists only
update_user_meta( $user->ID, 'password_rst_attempts', 0 );
}
}
add_action( 'wp_login', 'um_store_lastlogin_timestamp_' );