T
T
TERRAN472017-02-17 12:52:08
Laravel
TERRAN47, 2017-02-17 12:52:08

How to disable authorization after registering laravel 5.3?

All the best! In general, email confirmation is required, I sent a token with a link to the route where it will change the status of the added user from false to true, in the registration controller from the Laravel package, but after adding a new user, Lara automatically authorizes the user, which is not and is not necessary! let at atorizatsiya check I will make on the status false say that would confirm. So where exactly to disable authorization after registration?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
M
Mysterion, 2017-02-17
@Mysterion

Why not just add a middleware with a status check and if not confirmed, then send it to a page asking you to confirm the registration or send the code again?

E
Evgeny Perin, 2017-02-17
@seoperin

Override the registration method and write your logic there

T
TERRAN47, 2017-02-17
@TERRAN47

Here is the solution in /Foundation/Auth/RegistersUsers.php
public function register(Request $request)
{
$this->validator($request->all())->validate();
event(new Registered($user = $this->create($request->all())));
$this->guard()->login($user); // DELETE THIS LINE!!!
return $this->registered($request, $user) ?: redirect($this->redirectPath());
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question