mirror of
https://github.com/tomru/pfadi-bussle.git
synced 2026-03-03 06:27:11 +01:00
defensive email verification check
This commit is contained in:
@@ -32,15 +32,15 @@ export default NextAuth({
|
||||
callbacks: {
|
||||
async signIn({ account, email }) {
|
||||
// if user sigin requested magic link via EmailProvider
|
||||
if (account.provider === 'email') {
|
||||
if (email.verificationRequest) {
|
||||
if (account?.provider === 'email') {
|
||||
if (email?.verificationRequest) {
|
||||
// only allow admins by email entered
|
||||
return account.providerAccountId === ADMIN_EMAIL
|
||||
}
|
||||
|
||||
// if user accesses with magic link, also only allow admin
|
||||
return account.providerAccountId === ADMIN_EMAIL
|
||||
} else if (account.provider === 'github') {
|
||||
} else if (account?.provider === 'github') {
|
||||
// only one and only one user
|
||||
return GITHUB_USERS_GRANTED.includes(account.providerAccountId)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user