@@ -28,7 +28,7 @@ router.post('/login', (req, res) => {
28
28
} ,
29
29
30
30
( 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 ) {
32
32
return callback ( 'Use NIT KKR domain email only' , null ) ;
33
33
}
34
34
return callback ( null , user ) ;
@@ -44,8 +44,10 @@ router.post('/login', (req, res) => {
44
44
return callback ( err , null ) ;
45
45
}
46
46
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
+ }
49
51
authController . createUser ( user , ( err1 , newUser ) => {
50
52
if ( err1 ) {
51
53
logger . error ( err1 ) ;
@@ -108,7 +110,9 @@ router.post('/onboard', (req, res) => {
108
110
} , config . app . WEB_TOKEN_SECRET , {
109
111
expiresIn : config . app . jwt_expiry_time ,
110
112
} ) ;
111
- res . json ( ResponseTemplate . success ( 'On boarded successfully' , { token } ) ) ;
113
+ res . json ( ResponseTemplate . success ( 'On boarded successfully' , {
114
+ token,
115
+ } ) ) ;
112
116
} ) ;
113
117
}
114
118
} ) ;
0 commit comments