feat: Création d'un profile selector [#37,#38]

This commit is contained in:
Luc SORIGNET
2025-04-12 16:07:30 +02:00
parent 4c2e2f8756
commit 89b01b79db
16 changed files with 237 additions and 286 deletions

View File

@ -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;