Reputation: 718
Laravel provides password reset functionality. By default PasswordController constructor declares 'guest' middleware for all actions. But I'm confused. Is there any reasons to restrict authorized users to reset their passwords?
Upvotes: 0
Views: 921
Reputation: 16339
The middleware is checking if the user is logged in and if they are, redirecting them away:
public function handle($request, Closure $next)
{
if ($this->auth->check()) {
return redirect('/home');
}
return $next($request);
}
As a logged in user, you shouldn't have any need to reset your password as you obviously have a password that you used to log in - hence why there is middleware there to prevent you from accessing the password reset page when you do not need to.
In fact, as a logged in user you shouldn't need to go through any part of the password reset process - it is simply unnecessary.
However, if you don't want to use the middleware then you can simply remove it from the controller.
Upvotes: 0