Skip to content

Commit

Permalink
fix(recovery-phone): Don't strip nationalFormat number after successf…
Browse files Browse the repository at this point in the history
…ul setup

Because:
* We are stripping the nationalFormat from Twilio to only return 4 digits, even though the response in question is for a successful recovery phone set up

This commit:
* Returns the full nationalFormat in this case, as the user is logged in and confirmed their code

fixes FXA-11162
fixes FXA-11166
  • Loading branch information
LZoog authored and dschom committed Feb 21, 2025
1 parent f99ee3a commit 150bd0d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/fxa-auth-server/lib/routes/recovery-phone.ts
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,9 @@ class RecoveryPhoneHandler {

try {
const { phoneNumber, nationalFormat } =
await this.recoveryPhoneService.hasConfirmed(uid, 4);
// User has successfully set up a recovery phone. Give back the
// full nationalFormat (don't strip it).
await this.recoveryPhoneService.hasConfirmed(uid);
await this.mailer.sendPostAddRecoveryPhoneEmail(
account.emails,
account,
Expand Down
3 changes: 3 additions & 0 deletions packages/fxa-auth-server/test/local/routes/recovery-phone.js
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,9 @@ describe('/recovery_phone', () => {

assert.isDefined(resp);
assert.equal(resp.status, 'success');
// Gives back the full national format as the user just successfully
// confirmed the code
assert.equal(resp.nationalFormat, nationalFormat);
assert.equal(mockRecoveryPhoneService.confirmSetupCode.callCount, 1);
assert.equal(
mockRecoveryPhoneService.confirmSetupCode.getCall(0).args[0],
Expand Down

0 comments on commit 150bd0d

Please sign in to comment.