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

Function onSignInSubmit

auth/phone-invisible.ts:66–97  ·  view source on GitHub ↗

* Function called when clicking the Login/Logout button.

()

Source from the content-addressed store, hash-verified

64 * Function called when clicking the Login/Logout button.
65 */
66function onSignInSubmit() {
67 if (isPhoneNumberValid()) {
68 window.signingIn = true;
69 updateSignInButtonUI();
70 const phoneNumber = getPhoneNumberFromUserInput();
71 const appVerifier = window.recaptchaVerifier;
72 signInWithPhoneNumber(auth, phoneNumber, appVerifier!)
73 .then(function (confirmationResult) {
74 // SMS sent. Prompt user to type the code from the message, then sign the
75 // user in with confirmationResult.confirm(code).
76 window.confirmationResult = confirmationResult;
77 window.signingIn = false;
78 updateSignInButtonUI();
79 updateVerificationCodeFormUI();
80 updateVerifyCodeButtonUI();
81 updateSignInFormUI();
82 })
83 .catch(function (error) {
84 // Error; SMS not sent
85 console.error('Error during signInWithPhoneNumber', error);
86 window.alert(
87 'Error during signInWithPhoneNumber:\n\n' +
88 error.code +
89 '\n\n' +
90 error.message,
91 );
92 window.signingIn = false;
93 updateSignInFormUI();
94 updateSignInButtonUI();
95 });
96 }
97}
98
99/**
100 * Function called when clicking the "Verify Code" button.

Callers 1

phone-invisible.tsFile · 0.70

Calls 6

isPhoneNumberValidFunction · 0.70
updateSignInButtonUIFunction · 0.70
updateVerifyCodeButtonUIFunction · 0.70
updateSignInFormUIFunction · 0.70

Tested by

no test coverage detected