N
N
NikolayAlb2017-05-05 09:40:06
Laravel
NikolayAlb, 2017-05-05 09:40:06

Laravel 5.4 how to check user activation in standard login controller and add custom error?

I want to validate the 'activated' field of the user model before authorizing it and throw a custom error "Your account is not activated". I rummaged through the standard AuthenticatesUser.php trait, but didn't find a better solution than rewriting half of the trait.
How can this be implemented?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrzej Wielski, 2017-05-05
@wielski

In your case, it is enough to reassign the postLogin function, which actually authorizes the user.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question