[socialmon] auth: allow all @greatfrontend domain emails to login (#1430)

This commit is contained in:
Nitesh Seram 2025-04-29 17:11:04 +05:30 committed by GitHub
parent 13d5058703
commit 89b3981632
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 9 deletions

View File

@ -2,17 +2,10 @@ import type { GetServerSidePropsContext } from 'next';
import { getServerSession, type NextAuthOptions } from 'next-auth';
import GoogleProvider from 'next-auth/providers/google';
import type { PrismaClient } from '~/../prisma/generated/client';
import prisma from '~/server/prisma';
import { PrismaAdapter } from '@next-auth/prisma-adapter';
import type { PrismaClient } from '@prisma/client';
export const AUTHORIZED_EMAILS = [
'yangshun@greatfrontend.com',
'gina@greatfrontend.com',
'nitesh@greatfrontend.com',
'nikki@greatfrontend.com',
];
const ADMIN_EMAILS = ['yangshun@greatfrontend.com', 'gina@greatfrontend.com'];
@ -30,7 +23,7 @@ export const authConfig: NextAuthOptions = {
return session;
},
async signIn({ profile }) {
if (AUTHORIZED_EMAILS.includes(profile?.email ?? '')) {
if ((profile?.email ?? '').includes('@greatfrontend.com')) {
return true;
}