Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(frontend): ログイン画面でキャプチャが表示されない問題を修正 #14694

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions packages/frontend/src/components/MkSignin.vue
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ function onPasskeyLogin(): void {
page.value = 'passkey';
waiting.value = false;
})
.catch(onLoginFailed);
.catch(onSigninApiError);
}
}

Expand All @@ -137,11 +137,11 @@ function onPasskeyDone(credential: AuthenticationPublicKeyCredential): void {
context: passkeyContext.value,
}).then((res) => {
if (res.signinResponse == null) {
onLoginFailed();
onSigninApiError();
return;
}
emit('login', res.signinResponse);
}).catch(onLoginFailed);
}).catch(onSigninApiError);
} else if (userInfo.value != null) {
tryLogin({
username: userInfo.value.username,
Expand Down Expand Up @@ -231,7 +231,7 @@ async function tryLogin(req: Partial<Misskey.entities.SigninRequest>): Promise<M
await onLoginSucceeded(res);
return res;
}).catch((err) => {
onLoginFailed(err);
onSigninApiError(err);
return Promise.reject(err);
});
}
Expand All @@ -242,16 +242,18 @@ async function onLoginSucceeded(res: Misskey.entities.SigninResponse) {
}
}

function onLoginFailed(err?: any): void {
function onSigninApiError(err?: any): void {
const id = err?.id ?? null;

if (typeof err === 'object' && 'next' in err) {
switch (err.next) {
case 'captcha': {
needCaptcha.value = true;
page.value = 'password';
break;
}
case 'password': {
needCaptcha.value = false;
page.value = 'password';
break;
}
Expand Down Expand Up @@ -365,6 +367,7 @@ function onLoginFailed(err?: any): void {

onBeforeUnmount(() => {
password.value = '';
needCaptcha.value = false;
userInfo.value = null;
});
</script>
Expand Down
Loading