diff --git a/lang/strings_english.txt b/lang/strings_english.txt index 9b3d08ec88..59fe1238d1 100644 --- a/lang/strings_english.txt +++ b/lang/strings_english.txt @@ -975,6 +975,7 @@ $s_confirm_account_pruning = 'Are you sure you want to delete old accounts that # manage_user_page.php $s_edit_user_title = 'Edit User'; +$s_account_unlock_button = 'Unlock Account'; $s_reset_password_button = 'Reset Password'; $s_delete_user_button = 'Delete User'; $s_reset_password_msg = 'Reset Password sends the confirmation URL via e-mail.'; @@ -987,6 +988,7 @@ $s_users_new = 'New'; $s_account_reset_protected_msg = 'Account protected. Cannot reset the password.'; $s_account_reset_msg = 'A confirmation request has been sent to the selected user\'s e-mail address. Using this, the user will be able to change their password.'; $s_account_reset_msg2 = 'Account password has been set to blank...'; +$s_account_unlock_msg = 'The account has been unlocked.'; # manage_user_update.php $s_manage_user_protected_msg = 'Account protected. Access level and enabled protected. Otherwise, account has been updated...'; diff --git a/manage_user_edit_page.php b/manage_user_edit_page.php index 1c06aed673..e123170b62 100644 --- a/manage_user_edit_page.php +++ b/manage_user_edit_page.php @@ -119,7 +119,7 @@ ?> - + > @@ -175,38 +175,49 @@
+ 0; + $t_delete = !( ( user_is_administrator( $t_user_id ) && ( user_count_level( config_get_global( 'admin_site_threshold' ) ) <= 1 ) ) ); + + if( $t_reset || $t_unlock || $t_delete ) { +?>
- - + +
+ + + +
- +
-
-
- -
- -
+ +
+
+ +
+ diff --git a/manage_user_reset.php b/manage_user_reset.php index 47b81114c5..15c70d2777 100644 --- a/manage_user_reset.php +++ b/manage_user_reset.php @@ -40,8 +40,14 @@ # current user. access_ensure_global_level( $t_user['access_level'] ); - if ( !helper_call_custom_function( 'auth_can_change_password', array() ) ) { - trigger_error( ERROR_LOST_PASSWORD_NOT_ENABLED, ERROR ); + # If the password can be changed, we reset it, otherwise we unlock + # the account (i.e. reset failed login count) + $t_reset = helper_call_custom_function( 'auth_can_change_password', array() ); + + if ( $t_reset ) { + $t_result = user_reset_password( $f_user_id ); + } else { + $t_result = user_reset_failed_login_count_to_zero( $f_user_id ); } $t_result = user_reset_password( $f_user_id ); @@ -54,18 +60,23 @@ echo '
'; echo '
'; - if ( false == $t_result ) { - # PROTECTED - echo lang_get( 'account_reset_protected_msg' ) . '
'; - } else { - # SUCCESS - if ( ( ON == config_get( 'send_reset_password' ) ) && ( ON == config_get( 'enable_email_notification' ) ) ) { - # send the new random password via email - echo lang_get( 'account_reset_msg' ) . '
'; + if ( $t_reset ) { + if ( false == $t_result ) { + # PROTECTED + echo lang_get( 'account_reset_protected_msg' ) . '
'; } else { - # email notification disabled, then set the password to blank - echo lang_get( 'account_reset_msg2' ) . '
'; + # SUCCESSFUL RESET + if ( ( ON == config_get( 'send_reset_password' ) ) && ( ON == config_get( 'enable_email_notification' ) ) ) { + # send the new random password via email + echo lang_get( 'account_reset_msg' ) . '
'; + } else { + # email notification disabled, then set the password to blank + echo lang_get( 'account_reset_msg2' ) . '
'; + } } + } else { + # UNLOCK + echo lang_get( 'account_unlock_msg' ) . '
'; } print_bracket_link( $t_redirect_url, lang_get( 'proceed' ) );