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