Skip to content
This repository has been archived by the owner on Apr 19, 2023. It is now read-only.

Commit

Permalink
✨ Add newUserRegistrationDomains check
Browse files Browse the repository at this point in the history
  • Loading branch information
AnandChowdhary committed Sep 24, 2020
1 parent b248d84 commit 54774f2
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/_staart/rest/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,11 @@ export const register = async (
) => {
if (!config("newUserRegistrations"))
throw new Error("User registrations are not enabled");
if (config("newUserRegistrationDomains")) {
const domains = config<string[]>("newUserRegistrationDomains");
if (!domains.includes(email?.split("@")[1] ?? ""))
throw new Error("This domain is not allowed");
}
if (email) {
const isNewEmail =
(await prisma.emails.findMany({ where: { email, isVerified: true } }))
Expand Down

0 comments on commit 54774f2

Please sign in to comment.