From 88325d8e5eb59abd952bc7de17243bb15387b069 Mon Sep 17 00:00:00 2001 From: kakkokari-gtyih <67428053+kakkokari-gtyih@users.noreply.github.com> Date: Fri, 4 Oct 2024 09:35:08 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=B8=80=E9=83=A8=E3=81=AE=E3=82=A8?= =?UTF-8?q?=E3=83=A9=E3=83=BC=E3=81=8C=E3=81=A1=E3=82=83=E3=82=93=E3=81=A8?= =?UTF-8?q?=E5=87=BA=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/frontend/src/components/MkSignin.vue | 24 +++++++------------ 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/packages/frontend/src/components/MkSignin.vue b/packages/frontend/src/components/MkSignin.vue index 2a521e0119..81a98cae0e 100644 --- a/packages/frontend/src/components/MkSignin.vue +++ b/packages/frontend/src/components/MkSignin.vue @@ -163,16 +163,6 @@ async function onUsernameSubmitted(username: string) { username, }).catch(() => null); - if (userInfo.value == null) { - await os.alert({ - type: 'error', - title: i18n.ts.noSuchUser, - text: i18n.ts.signinFailed, - }); - waiting.value = false; - return; - } - await tryLogin({ username, }); @@ -223,15 +213,19 @@ async function onTotpSubmitted(token: string) { } async function tryLogin(req: Partial): Promise { - if (userInfo.value == null) { - throw new Error('No such user'); - } - const _req = { - username: userInfo.value.username, + username: req.username ?? userInfo.value?.username, ...req, }; + function assertIsSigninRequest(x: Partial): x is Misskey.entities.SigninRequest { + return x.username != null; + } + + if (!assertIsSigninRequest(_req)) { + throw new Error('Invalid request'); + } + return await misskeyApi('signin', _req).then(async (res) => { emit('login', res); await onLoginSucceeded(res);