Skip to content

Commit

Permalink
Merge pull request #12 from LarveyOfficial/dev
Browse files Browse the repository at this point in the history
Release 1.4
  • Loading branch information
LarveyOfficial authored Dec 26, 2023
2 parents e4b5a27 + f905122 commit 7093c85
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/pages/api/auth/[...nextauth].js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import NextAuth from "next-auth";
import { connectToDatabase } from "../lib/database";
import GoogleProvider from "next-auth/providers/google";


export const authOptions = {
providers: [
GoogleProvider({
Expand All @@ -12,6 +14,14 @@ export const authOptions = {
pages: {
signIn: "/panel",
},
callbacks: {
async signIn({account, profile}) {
const db = await connectToDatabase();
const collection = await db.collection("authorizedUsers");
const data = await collection.distinct("email");
return data.includes(profile?.email)
}
}
};

export default NextAuth(authOptions);

1 comment on commit 7093c85

@vercel
Copy link

@vercel vercel bot commented on 7093c85 Dec 26, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.