0

I installed latest Laravel 9 Framework, but it's really changed from 8.

I want to activate manually the users after registration so I want to stop autologin after user registration but I cannot understand what I need to change to stop this autologin. The only way seems to be create a new registration page with a new controller.... do you know if there are other ways?

Thanks in advance Dierre

miken32
  • 42,008
  • 16
  • 111
  • 154
Dierre
  • 23
  • 1
  • 6
  • see solution to related issue here https://stackoverflow.com/a/73493357/16723209 – CAPSLOCK Aug 25 '22 at 20:30
  • Does this answer your question? [Laravel - Disable auto login after registration](https://stackoverflow.com/questions/43226145/laravel-5-4-disable-auto-login-after-registration) – miken32 May 31 '23 at 19:59

2 Answers2

1

Change redirect to in RegisterController.php (path: app/Http/Controllers/Auth).

protected $redirectTo = '/your url';
EHF Shahab
  • 700
  • 4
  • 14
0

Inside the file App/Http/Controllers/Auth/RegisterController.

Change the snippet:

public function __construct()
    {
        $this->middleware('guest');
    }

For:

public function __construct()
    {
        $this->middleware('auth');
    }

Thus, the "register" route is no longer public and will only be accessed after the change, by anyone who is already logged into the system.

  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community May 30 '23 at 06:58