mirror of
https://git.v0id.ovh/n3wt-innov/n3wt-school.git
synced 2026-01-29 07:53:23 +00:00
feat: Création d'un profile selector [#37,#38]
This commit is contained in:
@ -11,15 +11,13 @@ const options = {
|
||||
name: 'Credentials',
|
||||
credentials: {
|
||||
email: { label: 'Email', type: 'email' },
|
||||
password: { label: 'Password', type: 'password' },
|
||||
role_type: { label: 'Role Type', type: 'text' }
|
||||
password: { label: 'Password', type: 'password' }
|
||||
},
|
||||
authorize: async (credentials, req) => {
|
||||
try {
|
||||
const data = {
|
||||
email: credentials.email,
|
||||
password: credentials.password,
|
||||
role_type: credentials.role_type
|
||||
password: credentials.password
|
||||
};
|
||||
|
||||
const user = await getJWT(data);
|
||||
@ -87,14 +85,15 @@ const options = {
|
||||
},
|
||||
async session({ session, token }) {
|
||||
if (token && token?.token) {
|
||||
const { user_id, email, roles } = jwt_decode.decode(token.token);
|
||||
const { user_id, email, roles, roleIndexLoginDefault } = jwt_decode.decode(token.token);
|
||||
session.user = {
|
||||
...session.user,
|
||||
token: token.token,
|
||||
refresh: token.refresh,
|
||||
user_id: user_id,
|
||||
email: email,
|
||||
roles: roles
|
||||
roles: roles,
|
||||
roleIndexLoginDefault : roleIndexLoginDefault
|
||||
};
|
||||
}
|
||||
return session;
|
||||
|
||||
Reference in New Issue
Block a user