()
| 166 | } |
| 167 | |
| 168 | const sendVerificationCode = async () => { |
| 169 | if (inputs.email === '') return; |
| 170 | if (turnstileEnabled && turnstileToken === '') { |
| 171 | showInfo('请稍后几秒重试,Turnstile 正在检查用户环境!'); |
| 172 | return; |
| 173 | } |
| 174 | setVerificationCodeLoading(true); |
| 175 | try { |
| 176 | const res = await API.get( |
| 177 | `/api/verification?email=${inputs.email}&turnstile=${turnstileToken}`, |
| 178 | ); |
| 179 | const { success, message } = res.data; |
| 180 | if (success) { |
| 181 | showSuccess('验证码发送成功,请检查你的邮箱!'); |
| 182 | } else { |
| 183 | showError(message); |
| 184 | } |
| 185 | } catch (error) { |
| 186 | showError('发送验证码失败,请重试'); |
| 187 | } finally { |
| 188 | setVerificationCodeLoading(false); |
| 189 | } |
| 190 | }; |
| 191 | |
| 192 | const handleGitHubClick = () => { |
| 193 | setGithubLoading(true); |
nothing calls this directly
no test coverage detected