I want to check if user status is active or not and want to login the user only if status='active'. Currently I am trying like this but it doesn't work
try{
const user= await auth.attempt(data.email,data.password).where('status', 'active')
return user
}catch(e){
return response.status(401).json(
{
'msg': 'Invalid email or password. Please try again.'
}
)
}
Is there anything to check different columns in the user table? Thanks
Found the answer from adonis.js discor group. I need to use something like this
auth.query(function (query) {
query.where('status', 'active')
}).attempt(data.email,data.password)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.