MCPcopy Create free account
hub / github.com/firebase/quickstart-js / onVerifyCodeSubmit

Function onVerifyCodeSubmit

auth/phone-invisible.ts:102–131  ·  view source on GitHub ↗

* Function called when clicking the "Verify Code" button.

(e: Event)

Source from the content-addressed store, hash-verified

100 * Function called when clicking the "Verify Code" button.
101 */
102function onVerifyCodeSubmit(e: Event) {
103 e.preventDefault();
104 if (!!getCodeFromUserInput()) {
105 window.verifyingCode = true;
106 updateVerifyCodeButtonUI();
107 const code = getCodeFromUserInput();
108 window
109 .confirmationResult!.confirm(code)
110 .then(function (result) {
111 // User signed in successfully.
112 const user = result.user;
113 window.verifyingCode = false;
114 window.confirmationResult = null;
115 updateVerificationCodeFormUI();
116 })
117 .catch(function (error) {
118 // User couldn't sign in (bad verification code?)
119 console.error('Error while checking the verification code', error);
120 window.alert(
121 'Error while checking the verification code:\n\n' +
122 error.code +
123 '\n\n' +
124 error.message,
125 );
126 window.verifyingCode = false;
127 updateSignInButtonUI();
128 updateVerifyCodeButtonUI();
129 });
130 }
131}
132
133/**
134 * Cancels the verification code input.

Callers

nothing calls this directly

Calls 4

getCodeFromUserInputFunction · 0.70
updateVerifyCodeButtonUIFunction · 0.70
updateSignInButtonUIFunction · 0.70

Tested by

no test coverage detected