mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-15 05:19:49 +00:00
Add restrict signup based on domain
This commit is contained in:
@@ -23,8 +23,16 @@ export const registerSignupRouter = async (server: FastifyZodProvider) => {
|
||||
}
|
||||
},
|
||||
handler: async (req) => {
|
||||
await server.services.signup.beginEmailSignupProcess(req.body.email);
|
||||
return { message: `Sent an email verification code to ${req.body.email}` };
|
||||
const { email } = req.body;
|
||||
const config = await server.services.superAdmin.initServerCfg();
|
||||
|
||||
if (config?.allowSpecificDomainSignUp) {
|
||||
const domain = email.split("@")[1];
|
||||
|
||||
if (domain !== config.allowSpecificDomainSignUp) throw new Error(`Unsupported email domain (${domain}).`);
|
||||
}
|
||||
await server.services.signup.beginEmailSignupProcess(email);
|
||||
return { message: `Sent an email verification code to ${email}` };
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user