Skip to content

Commit

Permalink
review feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
jaredhirsch committed Aug 22, 2019
1 parent 9ef3e77 commit ea40561
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
16 changes: 8 additions & 8 deletions packages/fxa-auth-server/lib/routes/password.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,14 +144,14 @@ module.exports = function(
originatingDeviceId,
hasTotp = false;

return checkTotpToken()
.then(getSessionVerificationStatus)
.then(fetchDevicesToNotify)
.then(changePassword)
.then(notifyAccount)
.then(createSessionToken)
.then(createKeyFetchToken)
.then(createResponse);
await checkTotpToken();
await getSessionVerificationStatus();
await fetchDevicesToNotify();
await changePassword();
await notifyAccount();
await createSessionToken();
await createKeyFetchToken();
await createResponse();

async function checkTotpToken() {
const result = await totpUtils.hasTotpToken(passwordChangeToken);
Expand Down
7 changes: 4 additions & 3 deletions packages/fxa-auth-server/lib/routes/totp.js
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,9 @@ module.exports = (log, db, mailer, customs, config) => {
// cases where the user started creating a token but never completed.
if (!token.verified) {
await db.deleteTotpToken(sessionToken.uid);
} else {
exists = true;
}
exists = true;
} catch (err) {
if (err.errno === errors.ERRNO.TOTP_TOKEN_NOT_FOUND) {
exists = false;
Expand Down Expand Up @@ -270,10 +271,10 @@ module.exports = (log, db, mailer, customs, config) => {

if (isValidCode) {
log.info('totp.verified', { uid });
request.emitMetricsEvent('totpToken.verified', { uid });
await request.emitMetricsEvent('totpToken.verified', { uid });
} else {
log.info('totp.unverified', { uid });
request.emitMetricsEvent('totpToken.unverified', { uid });
await request.emitMetricsEvent('totpToken.unverified', { uid });
}

await sendEmailNotification();
Expand Down

0 comments on commit ea40561

Please sign in to comment.