mirror of
https://github.com/wintercms/winter.git
synced 2024-06-28 05:33:29 +02:00
Add "Send password reset email" button to backend users update page (#723)
This commit is contained in:
parent
c6a2fe557c
commit
2fc9997542
@ -1,5 +1,6 @@
|
||||
<?php namespace Backend\Controllers;
|
||||
|
||||
use Mail;
|
||||
use Lang;
|
||||
use Flash;
|
||||
use Backend;
|
||||
@ -233,4 +234,30 @@ class Users extends Controller
|
||||
]
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Send password reset mail
|
||||
*/
|
||||
public function update_onManualPasswordReset($recordId)
|
||||
{
|
||||
$user = $this->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();
|
||||
}
|
||||
}
|
||||
|
12
modules/backend/controllers/users/_btn_password_reset.php
Normal file
12
modules/backend/controllers/users/_btn_password_reset.php
Normal file
@ -0,0 +1,12 @@
|
||||
<div class="loading-indicator-container">
|
||||
<button
|
||||
type="button"
|
||||
data-request="onManualPasswordReset"
|
||||
data-load-indicator="<?= e(trans('backend::lang.account.sending')) ?>"
|
||||
data-request-confirm="<?= e(trans('backend::lang.account.manual_password_reset_confirm')) ?>"
|
||||
class="btn btn-primary wn-icon-envelope"
|
||||
style="width: 100%; text-align: center"
|
||||
>
|
||||
<?= e(trans('backend::lang.account.password_reset_email')) ?>
|
||||
</button>
|
||||
</div>
|
@ -75,6 +75,10 @@ return [
|
||||
'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',
|
||||
|
@ -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:
|
||||
|
Loading…
x
Reference in New Issue
Block a user