Using other parameters to auth #1382
Replies: 5 comments 1 reply
-
They have to be there and exist in your User Model, but you do not have to use them and you can |
Beta Was this translation helpful? Give feedback.
-
I think don't explained so good, i have the Project model, and to login will have name and key (uuid). But in the auth contract, need to have the password |
Beta Was this translation helpful? Give feedback.
-
That is what i wan't to change |
Beta Was this translation helpful? Give feedback.
-
You can make custom authorization logic, but the models will still require the two fields ( (Per: #1306 (comment)) import Hash from '@ioc:Adonis/Core/Hash'
...
// Assuming providedName is a username-like (string) field.
// Assuming providedUID is a password-like (string) field.
const project = await Project.query().where({ name: providedName }).firstOrFail()
const isValid = await Hash.verify(project.key, providedUID)
if (!isValid) {
// return error
}
await auth.login(project) or if your key isn't hashed: // Assuming providedName is a username-like (string) field.
// Assuming providedUID is a string field.
const project = await Project.query().where({ name: providedName, key: providedUID }).firstOrFail()
await auth.login(project) |
Beta Was this translation helpful? Give feedback.
-
Im trying to use the auth, but need to use password parameter, and that not is what i want
In auth.ts the user provider needs password, how i can change? I create a new provider?
Beta Was this translation helpful? Give feedback.
All reactions