@@ -536,7 +536,6 @@ class RecoveryPhoneHandler {
536536 }
537537
538538 async changePhoneNumber ( request : AuthRequest ) {
539- // need to check first that there is an existing phone number
540539 const { uid } = request . auth . credentials as SessionTokenAuthCredential ;
541540
542541 const { code } = request . payload as unknown as {
@@ -602,11 +601,17 @@ class RecoveryPhoneHandler {
602601
603602 const { phoneNumber, nationalFormat } =
604603 await this . recoveryPhoneService . hasConfirmed ( uid ) ;
604+
605+ recordSecurityEvent ( 'account.recovery_phone_replace_complete' , {
606+ db : this . db ,
607+ request,
608+ } ) ;
609+
605610 const { acceptLanguage, geo, ua } = request . app ;
606611 const account = await this . db . account ( uid ) ;
607612
608613 try {
609- await this . mailer . postChangeRecoveryPhoneEmail ( account . emails , account , {
614+ await this . mailer . sendPostChangeRecoveryPhoneEmail ( account . emails , account , {
610615 acceptLanguage,
611616 timeZone : geo . timeZone ,
612617 uaBrowser : ua . browser ,
@@ -616,11 +621,6 @@ class RecoveryPhoneHandler {
616621 uaDeviceType : ua . deviceType ,
617622 uid,
618623 } ) ;
619-
620- recordSecurityEvent ( 'account.recovery_phone_replace_complete' , {
621- db : this . db ,
622- request,
623- } ) ;
624624 } catch ( error ) {
625625 // log error, but don't throw
626626 // user should be allowed to proceed if email or security event fails
0 commit comments