-
Notifications
You must be signed in to change notification settings - Fork 210
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(phone): Add unconfirmed
to RecoveryPhoneManager
#18012
Conversation
@@ -11,6 +11,12 @@ describe('RecoveryPhoneManager', () => { | |||
let recoveryPhoneManager: RecoveryPhoneManager; | |||
let db: AccountDatabase; | |||
|
|||
const redisMock = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Super small nit, we've been prefix with mock, so mockRedis
would be consistent perhaps.
* @param code The SMS code associated with this user | ||
* @returns The stored phone number data if found, or null if not found | ||
*/ | ||
async getUnconfirmed(uid: string, code: string): Promise<any> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should it be Promise<{phoneNumber:string, isSetup:boolean, lookupData:Record<string, any>|null}>
so it's symmetric?
lookupData: lookupData ? JSON.stringify(lookupData) : null, | ||
}; | ||
|
||
await this.redisClient.set(redisKey, JSON.stringify(data), 'EX', 600); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should 600 be hard coded?
|
||
@Injectable() | ||
export class RecoveryPhoneManager { | ||
private readonly redisPrefix = 'sms-attempt'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be hard coded? Maybe we need to pass in a config?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Just a couple nits take them or leave them.
Because
This pull request
Issue that this pull request solves
Closes: https://mozilla-hub.atlassian.net/browse/FXA-10346
Checklist
Other information (Optional)
I took a look at adding the
OtpManager
(same one we use for password reset code), but we would need to refactor it a good bit to accept additional data needed for sms. To unblock other stuff, we can add that in a follow up.