mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-24 21:24:13 -08:00
Added ability to trigger forgotten password emails for users
This commit is contained in:
parent
c2bb3892b7
commit
006a3adea0
|
@ -13,6 +13,7 @@ use App\Models\User;
|
|||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Password;
|
||||
|
||||
class BulkUsersController extends Controller
|
||||
{
|
||||
|
@ -34,11 +35,29 @@ class BulkUsersController extends Controller
|
|||
$statuslabel_list = Helper::statusLabelList();
|
||||
$users = User::whereIn('id', array_keys(request('ids')))
|
||||
->with('groups', 'assets', 'licenses', 'accessories')->get();
|
||||
|
||||
if ($request->input('bulk_actions') == 'edit') {
|
||||
return view('users/bulk-edit', compact('users'))
|
||||
->with('groups', Group::pluck('name', 'id'));
|
||||
|
||||
} elseif ($request->input('bulk_actions') == 'delete') {
|
||||
return view('users/confirm-bulk-delete', compact('users', 'statuslabel_list'));
|
||||
|
||||
} elseif ($request->input('bulk_actions') == 'bulkpasswordreset') {
|
||||
if ($users) {
|
||||
foreach ($users as $user) {
|
||||
if ($user->email!='') {
|
||||
$credentials = ['email' => $user->email];
|
||||
Password::sendResetLink($credentials, function (Message $message) {
|
||||
$message->subject($this->getEmailSubject());
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
return redirect()->back()->with('success', 'The selected users with email addresses have been sent a password reset link.');
|
||||
|
||||
}
|
||||
return view('users/confirm-bulk-delete', compact('users', 'statuslabel_list'));
|
||||
|
||||
}
|
||||
|
||||
return redirect()->back()->with('error', 'No users selected');
|
||||
|
@ -201,4 +220,6 @@ class BulkUsersController extends Controller
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -50,6 +50,7 @@
|
|||
<select name="bulk_actions" class="form-control select2" style="width: 200px;">
|
||||
<option value="delete">Bulk Checkin & Delete</option>
|
||||
<option value="edit">Bulk Edit</option>
|
||||
<option value="bulkpasswordreset">Send Password Reset</option>
|
||||
</select>
|
||||
<button class="btn btn-default" id="bulkEdit" disabled>Go</button>
|
||||
</div>
|
||||
|
|
Loading…
Reference in a new issue