Auth session add constraint (v4.1) #1667
-
Hi, is it possible to add constraint on authentication ? I want to log the user just if he has a specific value in db. Something like this : and use like this : Thanks for help. |
Beta Was this translation helpful? Give feedback.
Answered by
thetutlage
Sep 27, 2020
Replies: 1 comment 12 replies
-
Well, you can fetch the user yourself and then use const user = await User
.query()
.where('email', email)
.where('other', 'constraints')
.firstOrFail()
const isValid = await Hash.verify(user.password, password)
if(isValid) {
await auth.login(user)
} |
Beta Was this translation helpful? Give feedback.
12 replies
Answer selected by
Mzzay
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Well, you can fetch the user yourself and then use
auth.login
method. For example: