finished reset password & other changes
This commit is contained in:
@@ -5,10 +5,12 @@ import db from '@/lib/db'
|
||||
import authConfig from '@/auth.config'
|
||||
import { getUserById } from '@/data/user'
|
||||
import { AUTH_ERROR_URL, AUTH_LOGIN_URL } from '@/config/routes'
|
||||
import { getCurrentLocale } from '@/locales/server'
|
||||
import { type loc } from '@/config/locales'
|
||||
|
||||
declare module 'next-auth' {
|
||||
interface Session {
|
||||
user: { role: UserRole }
|
||||
user: { role: UserRole, locale: loc }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,6 +49,7 @@ export const {
|
||||
return true
|
||||
},
|
||||
async session ({ token, session }) {
|
||||
|
||||
if (token.sub && session.user) {
|
||||
session.user.id = token.sub
|
||||
}
|
||||
@@ -55,6 +58,8 @@ export const {
|
||||
session.user.role = token.role as UserRole
|
||||
}
|
||||
|
||||
session.user.locale = getCurrentLocale()
|
||||
|
||||
return session
|
||||
},
|
||||
async jwt ({ token }) {
|
||||
|
||||
Reference in New Issue
Block a user