Skip to content
This repository has been archived by the owner on Apr 3, 2019. It is now read-only.

Commit

Permalink
fix(config): Correctly resolve isSecondaryEmailEnabled and add more c…
Browse files Browse the repository at this point in the history
…hecks for config (#1872) r=vladikoff
  • Loading branch information
vbudhram authored and vladikoff committed Apr 30, 2017
1 parent 9f660d4 commit ae95582
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/features.js
Expand Up @@ -31,7 +31,7 @@ module.exports = config => {
* @returns {boolean}
*/
isSecondaryEmailEnabled() {
return !! secondaryEmail.enabled
return !! (secondaryEmail && secondaryEmail.enabled)
},

/**
Expand Down
4 changes: 2 additions & 2 deletions lib/routes/account.js
Expand Up @@ -514,7 +514,7 @@ module.exports = (
function checkSecondaryEmail() {
log.trace({op: 'Account.login.checkSecondaryEmail'})
if (! features.isSecondaryEmailEnabled()) {
return
return P.resolve()
}

// Currently, we only allow emails on the account table to log a user in.
Expand All @@ -529,7 +529,7 @@ module.exports = (
// No secondary email exists for this, continue with the regular login flow
if (err.errno === error.ERRNO.SECONDARY_EMAIL_UNKNOWN) {
log.trace({op: 'Account.login.checkSecondaryEmail.noconflict'})
return
return P.resolve()
}
throw err
})
Expand Down
4 changes: 3 additions & 1 deletion test/remote/recovery_email_emails.js
Expand Up @@ -20,7 +20,9 @@ describe('remote emails', function () {

before(() => {
config = require('../../config').getProperties()
config.secondaryEmail.enabled = true
config.secondaryEmail = {
enabled: true
}
config.securityHistory.ipProfiling = {}
return TestServer.start(config)
.then(s => {
Expand Down

0 comments on commit ae95582

Please sign in to comment.