diff --git a/lib/auth.ts b/lib/auth.ts index e0b0359af..f0e5f32c4 100644 --- a/lib/auth.ts +++ b/lib/auth.ts @@ -141,6 +141,13 @@ export const authOptions: NextAuthOptions = { // console.log('=============', token, user,) if (user) { token.user = user; + } else { + const updateUser = await prisma.user.findUnique({ where: { id: token.sub }}); + // console.log('========', updateUser) + if (!updateUser || !updateUser.allowToLogin) { + throw new Error('无法刷新令牌,用户状态不正确'); + } + token.user = updateUser; } return token; }, diff --git a/lib/auth_list.ts b/lib/auth_list.ts index 5f8420c4a..97eafa3e0 100644 --- a/lib/auth_list.ts +++ b/lib/auth_list.ts @@ -5,7 +5,7 @@ export const DENY_LIST: string[] = [ "zhangsan", ] export const ADMIN_LIST: string[] = [ - "司金辉", "sijinhui", "sijinhui@qq.com", + "sijinhui", "sijinhui@qq.com", "yuchuan", "于川", "jujujujuju", ]