Auth with custom fields #1306
-
Hey guys!! Hope everyone is safe. 🙇 ContextI have a defined database that my client very much insists on using, and on his database, the QuestionHow can I do that using the built-in |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Simply fetch the user yourself from the database, verify the password and then use import Hash from '@ioc:Adonis/Core/Hash'
const user = await User.query().where().firstOrFail()
const isValid = await Hash.verify(user.password, passwordSubmittedInForm)
if (!isValid) {
// return error
}
await auth.login(user) |
Beta Was this translation helpful? Give feedback.
Simply fetch the user yourself from the database, verify the password and then use
auth.login
method. This is how it should roughly look like.