diff --git a/modules/backend/controllers/Users.php b/modules/backend/controllers/Users.php index 1dc885f4c9..9151933e76 100644 --- a/modules/backend/controllers/Users.php +++ b/modules/backend/controllers/Users.php @@ -1,5 +1,6 @@ formFindModelObject($recordId); + + if ($user) { + $code = $user->getResetPasswordCode(); + $link = Backend::url('backend/auth/reset/' . $user->id . '/' . $code); + + $data = [ + 'name' => $user->full_name, + 'link' => $link, + ]; + + Mail::send('backend::mail.restore', $data, function ($message) use ($user) { + $message->to($user->email, $user->full_name)->subject(trans('backend::lang.account.password_reset')); + }); + } + + Flash::success(Lang::get('backend::lang.account.manual_password_reset_success')); + + return Redirect::refresh(); + } } diff --git a/modules/backend/controllers/users/_btn_password_reset.php b/modules/backend/controllers/users/_btn_password_reset.php new file mode 100644 index 0000000000..78dc211c60 --- /dev/null +++ b/modules/backend/controllers/users/_btn_password_reset.php @@ -0,0 +1,12 @@ +
+ +
diff --git a/modules/backend/lang/en/lang.php b/modules/backend/lang/en/lang.php index 9dc854fe4e..318517f5a2 100644 --- a/modules/backend/lang/en/lang.php +++ b/modules/backend/lang/en/lang.php @@ -75,6 +75,10 @@ 'cancel' => 'Cancel', 'delete' => 'Delete', 'ok' => 'OK', + 'sending' => 'Sending...', + 'password_reset_email' => 'Send password reset email', + 'manual_password_reset_confirm' => 'Are you sure you want to send a password reset email to this user?', + 'manual_password_reset_success' => 'An email has been sent to the user with instructions to reset their password.', ], 'dashboard' => [ 'menu_label' => 'Dashboard', diff --git a/modules/backend/models/user/fields.yaml b/modules/backend/models/user/fields.yaml index bbfbae286f..8b34fb476d 100644 --- a/modules/backend/models/user/fields.yaml +++ b/modules/backend/models/user/fields.yaml @@ -68,11 +68,15 @@ tabs: secondaryTabs: fields: btn_impersonate: - label: '' + label: "" context: [update] type: partial btn_unsuspend: - label: '' + label: "" + context: [update] + type: partial + btn_password_reset: + label: "" context: [update] type: partial avatar: