@@ -531,7 +531,6 @@ class RecoveryPhoneHandler {
531531 }
532532
533533 async changePhoneNumber ( request : AuthRequest ) {
534- // need to check first that there is an existing phone number
535534 const { uid } = request . auth . credentials as SessionTokenAuthCredential ;
536535
537536 const { code } = request . payload as unknown as {
@@ -597,11 +596,17 @@ class RecoveryPhoneHandler {
597596
598597 const { phoneNumber, nationalFormat } =
599598 await this . recoveryPhoneService . hasConfirmed ( uid ) ;
599+
600+ recordSecurityEvent ( 'account.recovery_phone_replace_complete' , {
601+ db : this . db ,
602+ request,
603+ } ) ;
604+
600605 const { acceptLanguage, geo, ua } = request . app ;
601606 const account = await this . db . account ( uid ) ;
602607
603608 try {
604- await this . mailer . postChangeRecoveryPhoneEmail ( account . emails , account , {
609+ await this . mailer . sendPostChangeRecoveryPhoneEmail ( account . emails , account , {
605610 acceptLanguage,
606611 timeZone : geo . timeZone ,
607612 uaBrowser : ua . browser ,
@@ -611,11 +616,6 @@ class RecoveryPhoneHandler {
611616 uaDeviceType : ua . deviceType ,
612617 uid,
613618 } ) ;
614-
615- recordSecurityEvent ( 'account.recovery_phone_replace_complete' , {
616- db : this . db ,
617- request,
618- } ) ;
619619 } catch ( error ) {
620620 // log error, but don't throw
621621 // user should be allowed to proceed if email or security event fails
0 commit comments