fix(server): signup/signin logic (#4008)

This commit is contained in:
LongYinan
2023-08-29 19:22:56 +08:00
committed by GitHub
parent a046cdafa3
commit 54574e5cc3
8 changed files with 39 additions and 9 deletions

View File

@@ -266,15 +266,16 @@ export const NextAuthOptionsProvider: FactoryProvider<NextAuthOptions> = {
}
return session;
},
signIn: async ({ profile }) => {
signIn: async ({ profile, user }) => {
if (!config.affine.beta || !config.node.prod) {
return true;
}
if (profile?.email) {
return await prisma.newFeaturesWaitingList
const email = profile?.email ?? user.email;
if (email) {
return prisma.newFeaturesWaitingList
.findUnique({
where: {
email: profile.email,
email,
type: NewFeaturesKind.EarlyAccess,
},
})