Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disable password reset from Laravel

Tags:

php

laravel

How I can disable password reset? I need prevent resetting passwords on login page. How I can do it?

I tried do:

Auth::routes(['register' => false, 'password.request' => false, 'password.reset' => false]);

But not working. Password reset is working.

like image 473
Dronax Avatar asked Dec 04 '22 18:12

Dronax


1 Answers

Change,

'password.reset' => false

To,

'reset' => false

If that doesn't work, in ForgotPasswordController, you will see that a trait SendsPasswordResetEmails is used, in that you will find the function showLinkRequestForm which you can override:

public function showLinkRequestForm()
{
    return view('auth.passwords.email');
}

and replace it with a redirect to go back, or a 404, or something else that you want.


Alternatively, you could override the routes.

like image 152
Script47 Avatar answered Dec 06 '22 07:12

Script47