Skip to content

Commit 955b087

Browse files
committed
feat: add config for blocked email domains
1 parent 988039e commit 955b087

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/backend/src/routers/signup.js

+8
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,14 @@ module.exports = eggspress(['/signup'], {
145145

146146
const svc_cleanEmail = req.services.get('clean-email');
147147
const clean_email = svc_cleanEmail.clean(req.body.email);
148+
149+
if ( config.blocked_email_domains ) {
150+
for ( const suffix of config.blocked_email_domains ) {
151+
if ( clean_email.endsWith(suffix) ) {
152+
return res.status(400).send('Please enter a valid email address.');
153+
}
154+
}
155+
}
148156

149157
// duplicate username check
150158
if(await username_exists(req.body.username))

0 commit comments

Comments
 (0)