微调,暂不可用

This commit is contained in:
sijinhui 2024-04-21 23:57:13 +08:00
parent 4bc7f62c0b
commit cd68a0135e
2 changed files with 7 additions and 2 deletions

View File

@ -29,6 +29,9 @@ export const authOptions: NextAuthOptions = {
image: profile.avatar_url, image: profile.avatar_url,
}; };
}, },
httpOptions: {
timeout: 50000,
}
}), }),
EmailProvider({ EmailProvider({
server: { server: {
@ -152,11 +155,12 @@ export const authOptions: NextAuthOptions = {
// console.log('555555555,', session, token) // console.log('555555555,', session, token)
return session; return session;
}, },
// 过滤不存在的用户,目前没用 // 过滤不存在的用户
async signIn({ user, account, profile, email, credentials }) { async signIn({ user, account, profile, email, credentials }) {
const existingUser = await existUser(user as User); const existingUser = await existUser(user as User);
console.log('---', user, 'account', account, 'email', email, 'exist', existingUser) console.log('---', user, 'account', account, 'email', email, 'exist', existingUser)
return !!existingUser; // 顺便过滤掉不允许登录的用户
return !!existingUser && existingUser.allowToLogin;
} }
}, },
}; };

View File

@ -24,6 +24,7 @@ model User {
password String? password String?
createdAt DateTime @default(now()) createdAt DateTime @default(now())
updatedAt DateTime @updatedAt updatedAt DateTime @updatedAt
allowToLogin Boolean @default(true)
accounts Account[] accounts Account[]
sessions Session[] sessions Session[]
// sites Site[] // sites Site[]