Refactor to always use req.externalAuthenticationSystemUsed

This commit is contained in:
James Allen
2017-11-20 10:10:23 +00:00
parent ca0982a909
commit 311ebf89c4
2 changed files with 3 additions and 6 deletions
@@ -51,7 +51,6 @@ module.exports = UserController =
updateUserSettings : (req, res)->
user_id = AuthenticationController.getLoggedInUserId(req)
usingExternalAuth = settings.ldap? or settings.saml?
logger.log user_id: user_id, "updating account settings"
User.findById user_id, (err, user)->
if err? or !user?
@@ -84,7 +83,7 @@ module.exports = UserController =
user.ace.syntaxValidation = req.body.syntaxValidation
user.save (err)->
newEmail = req.body.email?.trim().toLowerCase()
if !newEmail? or newEmail == user.email or usingExternalAuth
if !newEmail? or newEmail == user.email or req.externalAuthenticationSystemUsed()
# end here, don't update email
AuthenticationController.setInSessionUser(req, {first_name: user.first_name, last_name: user.last_name})
return res.sendStatus 200