Skip to content

Commit 153efdd

Browse files
authored
Merge pull request #18255 from mozilla/FXA-10374
feat(fxa-settings): Implement using recovery phone to sign in
2 parents 30d65aa + 9b0fbc1 commit 153efdd

63 files changed

Lines changed: 1815 additions & 582 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

libs/accounts/recovery-phone/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ export * from './lib/recovery-phone.service';
33
export * from './lib/recovery-phone.provider';
44
export * from './lib/recovery-phone.service.config';
55
export * from './lib/sms.manager';
6-
export * from './lib/sms.manger.config';
6+
export * from './lib/sms.manager.config';
77
export * from './lib/twilio.config';
88
export * from './lib/twilio.provider';
99
export * from './lib/recovery-phone.errors';

libs/accounts/recovery-phone/src/lib/recovery-phone.provider.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
44

55
import { ConfigService } from '@nestjs/config';
6-
import { SmsManagerConfig } from './sms.manger.config';
6+
import { SmsManagerConfig } from './sms.manager.config';
77
import Redis from 'ioredis';
88
import { RecoveryPhoneConfig } from './recovery-phone.service.config';
99

libs/accounts/recovery-phone/src/lib/sms.manger.config.ts renamed to libs/accounts/recovery-phone/src/lib/sms.manager.config.ts

File renamed without changes.

libs/accounts/recovery-phone/src/lib/sms.manager.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { LOGGER_PROVIDER } from '@fxa/shared/log';
66
import { StatsDService } from '@fxa/shared/metrics/statsd';
77
import { Test, TestingModule } from '@nestjs/testing';
88
import { SmsManager } from './sms.manager';
9-
import { SmsManagerConfig } from './sms.manger.config';
9+
import { SmsManagerConfig } from './sms.manager.config';
1010
import { TwilioProvider } from './twilio.provider';
1111
import { TwilioErrorCodes } from './recovery-phone.errors';
1212

libs/accounts/recovery-phone/src/lib/sms.manager.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { Inject, Injectable, LoggerService } from '@nestjs/common';
88
import { StatsD } from 'hot-shots';
99
import { Twilio } from 'twilio';
1010
import { MessageInstance } from 'twilio/lib/rest/api/v2010/account/message';
11-
import { SmsManagerConfig } from './sms.manger.config';
11+
import { SmsManagerConfig } from './sms.manager.config';
1212
import { TwilioProvider } from './twilio.provider';
1313
import {
1414
RecoveryNumberInvalidFormatError,
@@ -70,6 +70,7 @@ export class SmsManager {
7070
retryCount: number
7171
): Promise<MessageInstance> {
7272
const from = this.rotateFromNumber();
73+
7374
try {
7475
const msg = await this.client.messages.create({
7576
to,

packages/fxa-auth-client/lib/client.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2338,7 +2338,7 @@ export default class AuthClient {
23382338
* @param code The otp code sent to the user's phone
23392339
* @param headers
23402340
*/
2341-
async recoveryPhoneSignInConfirm(
2341+
async recoveryPhoneSigninConfirm(
23422342
sessionToken: string,
23432343
code: string,
23442344
headers?: Headers

packages/fxa-auth-server/lib/authMethods.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ const METHOD_TO_AMR = {
1919
'email-2fa': 'email',
2020
'totp-2fa': 'otp',
2121
'recovery-code': 'otp',
22+
'sms-2fa': 'otp',
2223
};
2324

2425
// Maps AMR values to the type of authenticator they represent, e.g.

packages/fxa-auth-server/lib/routes/account.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1133,7 +1133,7 @@ export class AccountHandler {
11331133
}
11341134
}
11351135

1136-
// If they just went through the sigin-unblock flow, they have already verified their email.
1136+
// If they just went through the signin-unblock flow, they have already verified their email.
11371137
// We don't need to force them to do that again, just make a verified session.
11381138
if (didSigninUnblock) {
11391139
needsVerificationId = false;

packages/fxa-auth-server/test/remote/account_signin_verification_tests.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -781,14 +781,14 @@ const mocks = require('../mocks');
781781
})
782782
.then((emailData) => {
783783
assert.equal(emailData.headers['x-template-name'], 'verify');
784-
const siginToken = emailData.headers['x-verify-code'];
784+
const signinToken = emailData.headers['x-verify-code'];
785785
assert.notEqual(
786786
tokenCode,
787-
siginToken,
787+
signinToken,
788788
'login codes should not match'
789789
);
790790

791-
return client.verifyEmail(siginToken);
791+
return client.verifyEmail(signinToken);
792792
})
793793
.then(() => {
794794
return client.emailStatus();
@@ -812,7 +812,5 @@ const mocks = require('../mocks');
812812
assert.ok(keys.wrapKb, 'has wrapKb keys');
813813
});
814814
});
815-
816-
817815
});
818816
});

packages/fxa-auth-server/test/remote/recovery_phone_tests.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ describe(`#integration - recovery phone`, function () {
112112
await TestServer.stop(server);
113113
});
114114

115-
it('setups a recovery phone', async function () {
115+
it('sets up a recovery phone', async function () {
116116
if (!isTwilioConfigured) {
117117
this.skip('Invalid twilio accountSid or authToken. Check env / config!');
118118
}
@@ -185,7 +185,7 @@ describe(`#integration - recovery phone`, function () {
185185
assert.isFalse(checkResp2.exists);
186186
});
187187

188-
it('fails to setup invalid phone number', async function () {
188+
it('fails to set up invalid phone number', async function () {
189189
if (!isTwilioConfigured) {
190190
this.skip('Invalid twilio accountSid or authToken. Check env / config!');
191191
}

0 commit comments

Comments
 (0)