* Handles send code button click for second factor enrollment. * @param {!Event} e The send code for enrollment on click event.
(e: Event)
| 346 | * @param {!Event} e The send code for enrollment on click event. |
| 347 | */ |
| 348 | async function onEnrollSendCode(e: Event) { |
| 349 | e.preventDefault(); |
| 350 | if (isCaptchaOK() && isPhoneNumberValid() && auth.currentUser) { |
| 351 | const phoneNumber = phoneNumberInput.value; |
| 352 | |
| 353 | const provider = new PhoneAuthProvider(auth); |
| 354 | multiFactor(auth.currentUser) |
| 355 | .getSession() |
| 356 | .then(function (multiFactorSession) { |
| 357 | const phoneInfoOptions = { |
| 358 | phoneNumber: phoneNumber, |
| 359 | session: multiFactorSession, |
| 360 | }; |
| 361 | // Send code for enrollment. |
| 362 | return provider.verifyPhoneNumber(phoneInfoOptions, recaptchaVerifier!); |
| 363 | }) |
| 364 | .then( |
| 365 | function (verificationId) { |
| 366 | phoneVerificationId = verificationId; |
| 367 | // Update the multi-factor dialog to verify the sent code. |
| 368 | updateMfaDialog(); |
| 369 | }, |
| 370 | function (error) { |
| 371 | updateEnrollSendCodeButtonUI(); |
| 372 | displayMfaError(error); |
| 373 | }, |
| 374 | ); |
| 375 | } |
| 376 | } |
| 377 | |
| 378 | /** |
| 379 | * Handles verify code button click for second factor enrollment. |
nothing calls this directly
no test coverage detected