PASSWORD RESET

Your destination for complete Tech news

How to disable registration in Laravel Auth routes?

804 0
< 1 min read

To disable registration in Laravel’s built-in authentication system, you can follow these steps:

1. Open the routes/web.php file.

2. Comment out or remove the following line:

Auth::routes();

3. Add the following lines to the file:

// Authentication Routes...
Route::get('login', 'Auth\LoginController@showLoginForm')->name('login');
Route::post('login', 'Auth\LoginController@login');
Route::post('logout', 'Auth\LoginController@logout')->name('logout');

// Password Reset Routes...
Route::get('password/reset', 'Auth\ForgotPasswordController@showLinkRequestForm')->name('password.request');
Route::post('password/email', 'Auth\ForgotPasswordController@sendResetLinkEmail')->name('password.email');
Route::get('password/reset/{token}', 'Auth\ResetPasswordController@showResetForm')->name('password.reset');
Route::post('password/reset', 'Auth\ResetPasswordController@reset')->name('password.update');

// Email Verification Routes...
if (config('auth.users.verify_email')) {
    Route::emailVerification();
}

This will remove the registration routes and leave only the authentication, password reset, and email verification routes.

Leave A Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.