centralize email parsing logic
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { InferCreationAttributes } from "sequelize";
|
||||
import { UserRole } from "@shared/types";
|
||||
import { parseEmail } from "@shared/utils/email";
|
||||
import InviteAcceptedEmail from "@server/emails/templates/InviteAcceptedEmail";
|
||||
import {
|
||||
DomainNotAllowedError,
|
||||
@@ -226,7 +227,7 @@ export default async function userProvisioner({
|
||||
|
||||
// If the team settings do not allow this domain,
|
||||
// throw an error and fail user creation.
|
||||
const domain = email.split("@")[1];
|
||||
const { domain } = parseEmail(email);
|
||||
if (team && !(await team.isDomainAllowed(domain))) {
|
||||
throw DomainNotAllowedError();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user