Use language strings for bulk password reset

This commit is contained in:
snipe 2018-07-30 20:37:19 -07:00
parent 006a3adea0
commit 400913631c
2 changed files with 7 additions and 2 deletions

View file

@ -31,8 +31,12 @@ class BulkUsersController extends Controller
{ {
$this->authorize('update', User::class); $this->authorize('update', User::class);
// Make sure there were users selected
if (($request->filled('ids')) && (count($request->input('ids')) > 0)) { if (($request->filled('ids')) && (count($request->input('ids')) > 0)) {
$statuslabel_list = Helper::statusLabelList(); $statuslabel_list = Helper::statusLabelList();
// Get the list of affected users
$users = User::whereIn('id', array_keys(request('ids'))) $users = User::whereIn('id', array_keys(request('ids')))
->with('groups', 'assets', 'licenses', 'accessories')->get(); ->with('groups', 'assets', 'licenses', 'accessories')->get();
@ -46,7 +50,7 @@ class BulkUsersController extends Controller
} elseif ($request->input('bulk_actions') == 'bulkpasswordreset') { } elseif ($request->input('bulk_actions') == 'bulkpasswordreset') {
if ($users) { if ($users) {
foreach ($users as $user) { foreach ($users as $user) {
if ($user->email!='') { if (($user->activated=='1') && ($user->email!='')) {
$credentials = ['email' => $user->email]; $credentials = ['email' => $user->email];
Password::sendResetLink($credentials, function (Message $message) { Password::sendResetLink($credentials, function (Message $message) {
$message->subject($this->getEmailSubject()); $message->subject($this->getEmailSubject());
@ -54,7 +58,7 @@ class BulkUsersController extends Controller
} }
} }
} }
return redirect()->back()->with('success', 'The selected users with email addresses have been sent a password reset link.'); return redirect()->back()->with('success', trans('admin/users/message.password_resets_sent'));
} }

View file

@ -12,6 +12,7 @@ return array(
'insufficient_permissions' => 'Insufficient Permissions.', 'insufficient_permissions' => 'Insufficient Permissions.',
'user_deleted_warning' => 'This user has been deleted. You will have to restore this user to edit them or assign them new assets.', 'user_deleted_warning' => 'This user has been deleted. You will have to restore this user to edit them or assign them new assets.',
'ldap_not_configured' => 'LDAP integration has not been configured for this installation.', 'ldap_not_configured' => 'LDAP integration has not been configured for this installation.',
'password_resets_sent' => 'The selected users who are activated and have a valid email addresses have been sent a password reset link.',
'success' => array( 'success' => array(