MCPcopy Index your code
hub / github.com/firebase/quickstart-js / onSignInVerifyCode

Function onSignInVerifyCode

auth/mfa-password.ts:444–464  ·  view source on GitHub ↗

* Handles verify code button click for second factor sign-in. * @param {!Event} e The verify code for sign-in on click event.

(e: Event)

Source from the content-addressed store, hash-verified

442 * @param {!Event} e The verify code for sign-in on click event.
443 */
444function onSignInVerifyCode(e: Event) {
445 e.preventDefault();
446 if (mfaResolver && phoneVerificationId) {
447 const signInVerificationCodeInput = document.getElementById(
448 'sign-in-verification-code',
449 )! as HTMLInputElement;
450 const code = signInVerificationCodeInput.value;
451 const credential = PhoneAuthProvider.credential(phoneVerificationId, code);
452 const multiFactorAssertion =
453 PhoneMultiFactorGenerator.assertion(credential);
454 mfaResolver
455 .resolveSignIn(multiFactorAssertion)
456 .then(function () {
457 alertMessage('Signed in with second factor!');
458 clearMfaDialog();
459 const enrolledFactors = multiFactor(auth.currentUser!).enrolledFactors;
460 showEnrolledFactors(enrolledFactors);
461 })
462 .catch(displayMfaError);
463 }
464}
465
466/**
467 * Handles unenroll icon click for enrolled second factors.

Callers

nothing calls this directly

Calls 3

alertMessageFunction · 0.85
clearMfaDialogFunction · 0.85
showEnrolledFactorsFunction · 0.85

Tested by

no test coverage detected