Skip to content

Commit 3706761

Browse files
authoredDec 19, 2018
Merge pull request #35 from phoenixking25/master
allowed gmail domains
2 parents b93e714 + 810457f commit 3706761

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed
 

‎app/routes/auth/auth.js

+8-4
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ router.post('/login', (req, res) => {
2828
},
2929

3030
(user, callback) => {
31-
if (user.email.split('@')[1] !== 'nitkkr.ac.in') {
31+
if (user.email.split('@')[1] !== 'nitkkr.ac.in' && config.app.nitkkr_domain_email) {
3232
return callback('Use NIT KKR domain email only', null);
3333
}
3434
return callback(null, user);
@@ -44,8 +44,10 @@ router.post('/login', (req, res) => {
4444
return callback(err, null);
4545
}
4646
if (!usr) {
47-
// eslint-disable-next-line
48-
user.rollNo = user.email.split('@')[0].split('_')[1];
47+
if (config.app.nitkkr_domain_email) {
48+
// eslint-disable-next-line
49+
user.rollNo = user.email.split('@')[0].split('_')[1];
50+
}
4951
authController.createUser(user, (err1, newUser) => {
5052
if (err1) {
5153
logger.error(err1);
@@ -108,7 +110,9 @@ router.post('/onboard', (req, res) => {
108110
}, config.app.WEB_TOKEN_SECRET, {
109111
expiresIn: config.app.jwt_expiry_time,
110112
});
111-
res.json(ResponseTemplate.success('On boarded successfully', { token }));
113+
res.json(ResponseTemplate.success('On boarded successfully', {
114+
token,
115+
}));
112116
});
113117
}
114118
});

0 commit comments

Comments
 (0)
Please sign in to comment.