feat: implement admin user management interface and routes for CRUD operations and password resets
This commit is contained in:
@@ -94,4 +94,18 @@ class UserController extends Controller
|
||||
|
||||
return back()->with('success', 'Administrateur supprimé.');
|
||||
}
|
||||
|
||||
public function resetPassword(User $user)
|
||||
{
|
||||
if (!auth()->user()->isSuperAdmin()) {
|
||||
abort(403, 'Unauthorized action.');
|
||||
}
|
||||
|
||||
$password = Str::random(10);
|
||||
$user->update([
|
||||
'password' => Hash::make($password)
|
||||
]);
|
||||
|
||||
return back()->with('success', 'Nouveau mot de passe généré pour ' . $user->name . ' : ' . $password);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user