fix(sign-in): ログイン失敗時のエラーコードの統一 (MisskeyIO#843)

This commit is contained in:
あわわわとーにゅ 2024-12-25 09:43:25 +09:00 committed by GitHub
parent 6542ad4a12
commit 8abe8aecee
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
26 changed files with 53 additions and 25 deletions

View File

@ -822,6 +822,7 @@ unmuteThread: "ارفع الكتم عن النقاش"
continueThread: "اعرض بقية النقاش"
deleteAccountConfirm: "سيحذف حسابك نهائيًا، أتريد المتابعة؟"
incorrectPassword: "كلمة السر خاطئة."
authenticationFailed: "فشل التوثيق"
voteConfirm: "متيقِّن من تصويتك لـ {choice}؟"
hide: "إخفاء"
welcomeBackWithName: "مرحبًا بك مجددًا {name}"

View File

@ -815,6 +815,7 @@ unmuteThread: "থ্রেড আনমিউট করুন"
continueThread: "আরো থ্রেড দেখুন"
deleteAccountConfirm: "আপনার অ্যাকাউন্ট মুছে ফেলা হবে। ঠিক আছে?"
incorrectPassword: "আপনার দেওয়া পাসওয়ার্ডটি ভুল।"
authenticationFailed: "প্রমাণীকরণ ব্যর্থ হয়েছে।"
voteConfirm: "\"{choice}\" এ ভোট দিতে চান?"
hide: "লুকান"
useDrawerReactionPickerForMobile: "মোবাইলে রিঅ্যাকশন পিকারকে ড্রয়ারে প্রদর্শন করুন"

View File

@ -896,6 +896,7 @@ followersVisibility: "Visibilitat dels seguidors"
continueThread: "Veure la continuació del fil"
deleteAccountConfirm: "Això eliminarà el teu compte irreversiblement. Procedir?"
incorrectPassword: "Contrasenya incorrecta."
authenticationFailed: "Autenticació fallida."
voteConfirm: "Confirma el teu vot \"{choice}\""
hide: "Amagar"
useDrawerReactionPickerForMobile: "Mostrar el selector de reaccions com un calaix al mòbil "

View File

@ -859,6 +859,7 @@ unmuteThread: "Zrušit ztlumení vlákna"
continueThread: "Zobrazit pokračování vlákna"
deleteAccountConfirm: "Tohle nenávratně smaže váš účet, chcete pokračovat?"
incorrectPassword: "Nesprávné heslo."
authenticationFailed: "Ověření selhalo."
voteConfirm: "Potvrdit hlas pro \"{choice}\"?"
hide: "Skrýt"
useDrawerReactionPickerForMobile: "Zobrazit výběr reakcí jako šuplík na mobilním zařízení"

View File

@ -889,6 +889,7 @@ unmuteThread: "Threadstummschaltung aufheben"
continueThread: "Weiteren Threadverlauf anzeigen"
deleteAccountConfirm: "Dein Benutzerkonto wird unwiderruflich gelöscht. Trotzdem fortfahren?"
incorrectPassword: "Falsches Passwort."
authenticationFailed: "Authentifizierung fehlgeschlagen."
voteConfirm: "Wirklich für „{choice}“ abstimmen?"
hide: "Inhalt verbergen"
useDrawerReactionPickerForMobile: "Auf mobilen Geräten ausfahrbare Reaktionsauswahl anzeigen"

View File

@ -919,6 +919,7 @@ continueThread: "View thread continuation"
deleteAccountConfirm: "This will irreversibly delete your account. Proceed?"
deleteAccountConfirmAndWarn: "This will irreversibly delete your account.\nPlease note that re-logging in after a deletion request will interrupt the deletion of your account.\nProceed?"
incorrectPassword: "Incorrect password."
authenticationFailed: "Authentication failed."
voteConfirm: "Confirm your vote for \"{choice}\"?"
hide: "Hide"
useDrawerReactionPickerForMobile: "Display reaction picker as drawer on mobile"

View File

@ -896,6 +896,7 @@ followersVisibility: "Visibilidad de seguidores"
continueThread: "Ver la continuación del hilo"
deleteAccountConfirm: "La cuenta será borrada. ¿Está seguro?"
incorrectPassword: "La contraseña es incorrecta"
authenticationFailed: "La autenticación falló"
voteConfirm: "¿Confirma su voto a {choice}?"
hide: "Ocultar"
useDrawerReactionPickerForMobile: "Mostrar panel de reacciones en móviles"

View File

@ -896,6 +896,7 @@ followersVisibility: "Visibilité des abonnés"
continueThread: "Afficher la suite du fil"
deleteAccountConfirm: "Votre compte sera supprimé. Êtes vous certain ?"
incorrectPassword: "Le mot de passe est incorrect."
authenticationFailed: "L'authentification a échoué."
voteConfirm: "Confirmez-vous votre vote pour « {choice} » ?"
hide: "Masquer"
useDrawerReactionPickerForMobile: "Afficher le sélecteur de réactions en tant que panneau sur mobile"

View File

@ -896,6 +896,7 @@ followersVisibility: "Visibilitas pengikut"
continueThread: "Lihat lanjutan thread"
deleteAccountConfirm: "Akun akan dihapus. Apakah kamu yakin?"
incorrectPassword: "Kata sandi salah."
authenticationFailed: "Autentikasi gagal."
voteConfirm: "Konfirmasi suara kamu untuk ({choice})"
hide: "Sembunyikan"
useDrawerReactionPickerForMobile: "Tampilkan bilah reaksi sebagai laci di ponsel"

4
locales/index.d.ts vendored
View File

@ -3703,6 +3703,10 @@ export interface Locale extends ILocale {
*
*/
"incorrectPassword": string;
/**
*
*/
"authenticationFailed": string;
/**
* {choice}
*/

View File

@ -896,6 +896,7 @@ followersVisibility: "Visibilità dei profili che ti seguono"
continueThread: "Altre conversazioni"
deleteAccountConfirm: "Così verrà eliminato il profilo. Vuoi procedere?"
incorrectPassword: "La password è errata."
authenticationFailed: "Autenticazione fallita"
voteConfirm: "Votare per「{choice}」?"
hide: "Nascondere"
useDrawerReactionPickerForMobile: "Mostra sul drawer da dispositivo mobile"

View File

@ -921,6 +921,7 @@ continueThread: "さらにスレッドを見る"
deleteAccountConfirm: "アカウントが削除されます。よろしいですか?"
deleteAccountConfirmAndWarn: "アカウントが削除されます。\n削除リクエスト後に再ログインすると\nアカウントの削除が中断されてしまいますのでご注意ください。\nよろしいですか"
incorrectPassword: "パスワードが間違っています。"
authenticationFailed: "認証に失敗しました。"
voteConfirm: "「{choice}」に投票しますか?"
hide: "隠す"
useDrawerReactionPickerForMobile: "モバイルデバイスのときドロワーで表示"

View File

@ -896,6 +896,7 @@ followersVisibility: "フォロワーの公開範囲"
continueThread: "さらにスレッドを見るで"
deleteAccountConfirm: "アカウントを消すで?ええんか?"
incorrectPassword: "パスワードがちゃうわ。"
authenticationFailed: "認証失敗したで。"
voteConfirm: "「{choice}」に投票するんか?"
hide: "隠す"
useDrawerReactionPickerForMobile: "ケータイとかのときドロワーで表示するで"

View File

@ -918,6 +918,7 @@ continueThread: "글타래 더 보기"
deleteAccountConfirm: "계정이 삭제되고 되돌릴 수 없게 됩니다. 계속하시겠습니까?"
deleteAccountConfirmAndWarn: "계정이 삭제됩니다.\n삭제 요청 후 다시 로그인하면 계정 삭제가 중단되어 버립니다.\n계속하시겠습니까?"
incorrectPassword: "비밀번호가 올바르지 않습니다."
authenticationFailed: "인증에 실패했습니다."
voteConfirm: "\"{choice}\"에 투표하시겠습니까?"
hide: "숨기기"
useDrawerReactionPickerForMobile: "모바일에서 드로어 메뉴로 표시"

View File

@ -894,6 +894,7 @@ followersVisibility: "Widoczność obserwujących"
continueThread: "Pokaż kontynuację wątku"
deleteAccountConfirm: "Spowoduje to nieodwracalne usunięcie Twojego konta. Kontynuować?"
incorrectPassword: "Nieprawidłowe hasło."
authenticationFailed: "Uwierzytelnienie nie powiodło się."
voteConfirm: "Potwierdzić swój głos na \"{choice}\"?"
hide: "Ukryj"
useDrawerReactionPickerForMobile: "Wyświetlaj wybornik reakcji jako szufladę na urządzeniach mobilnych"

View File

@ -863,6 +863,7 @@ unmuteThread: "Desativar silêncio desta conversa"
continueThread: "Ver mais desta conversa"
deleteAccountConfirm: "Deseja realmente excluir a conta?"
incorrectPassword: "Senha inválida."
authenticationFailed: "Falha na autenticação."
voteConfirm: "Deseja confirmar o seu voto em \"{choice}\"?"
hide: "Ocultar"
useDrawerReactionPickerForMobile: "Mostrar em formato de gaveta"

View File

@ -881,6 +881,7 @@ unmuteThread: "Отменить сокрытие цепочки"
continueThread: "Показать следующие ответы"
deleteAccountConfirm: "Учётная запись будет безвозвратно удалена. Подтверждаете?"
incorrectPassword: "Пароль неверен."
authenticationFailed: "Аутентификация не удалась."
voteConfirm: "Отдать голос за «{choice}»?"
hide: "Спрятать"
useDrawerReactionPickerForMobile: "Выдвижная палитра на мобильном устройстве"

View File

@ -826,6 +826,7 @@ unmuteThread: "Zrušiť stíšenie vlákna"
continueThread: "Zobraziť pokračovanie vlákna"
deleteAccountConfirm: "Toto nezvrátiteľne vymaže váš účet. Pokračovať?"
incorrectPassword: "Nesprávne heslo."
authenticationFailed: "Overenie zlyhalo."
voteConfirm: "Potvrdzujete svoj hlas za \"{choice}\"?"
hide: "Skryť"
useDrawerReactionPickerForMobile: "Zobraziť výber reakcií ako šuflík na mobile"

View File

@ -466,6 +466,7 @@ squareAvatars: "Visa fyrkantiga profilbilder"
sent: "Skicka"
misskeyUpdated: "Misskey har uppdaterats!"
incorrectPassword: "Fel lösenord."
authenticationFailed: "Autentisering misslyckades."
welcomeBackWithName: "Välkommen tillbaka, {name}"
clickToFinishEmailVerification: "Tryck på [{ok}] för att slutföra bekräftelsen på e-postadressen."
searchByGoogle: "Sök"

View File

@ -896,6 +896,7 @@ followersVisibility: "การมองเห็นผู้ที่กำล
continueThread: "ดูความต่อเนื่องเธรด"
deleteAccountConfirm: "การดำเนินการนี้จะลบบัญชีของคุณอย่างถาวรเลยนะ แน่ใจหรอดำเนินการ?"
incorrectPassword: "รหัสผ่านไม่ถูกต้อง"
authenticationFailed: "การตรวจสอบตัวตนล้มเหลว"
voteConfirm: "ต้องการโหวต “{choice}” ใช่ไหม?"
hide: "ซ่อน"
useDrawerReactionPickerForMobile: "แสดง ตัวจิ้มรีแอคชั่น เป็นแบบลิ้นชัก เมื่อใช้บนมือถือ"

View File

@ -822,6 +822,7 @@ unmuteThread: "Скасувати глушіння"
continueThread: "Показати продовження треду"
deleteAccountConfirm: "Це незворотно видалить ваш акаунт. Продовжити?"
incorrectPassword: "Неправильний пароль."
authenticationFailed: "Аутентифікація не вдалася."
voteConfirm: "Підтверджуєте свій голос за \"{choice}\"?"
hide: "Сховати"
welcomeBackWithName: "З поверненням, {name}!"

View File

@ -876,6 +876,7 @@ followersVisibility: "Hiển thị người theo dõi"
continueThread: "Tiếp tục xem chuỗi tút"
deleteAccountConfirm: "Điều này sẽ khiến tài khoản bị xóa vĩnh viễn. Vẫn tiếp tục?"
incorrectPassword: "Sai mật khẩu."
authenticationFailed: "Xác thực thất bại."
voteConfirm: "Xác nhận bình chọn \"{choice}\"?"
hide: "Ẩn"
useDrawerReactionPickerForMobile: "Hiện bộ chọn biểu cảm dạng xổ ra trên điện thoại"

View File

@ -899,6 +899,7 @@ followersVisibility: "关注者的公开范围"
continueThread: "查看更多帖子"
deleteAccountConfirm: "将要删除账户。是否确认?"
incorrectPassword: "密码错误"
authenticationFailed: "认证失败"
voteConfirm: "确定投给 “{choice}” "
hide: "隐藏"
useDrawerReactionPickerForMobile: "在移动设备上使用抽屉显示"

View File

@ -896,6 +896,7 @@ followersVisibility: "追隨者的可見性"
continueThread: "查看更多貼文"
deleteAccountConfirm: "將要刪除帳戶。是否確定?"
incorrectPassword: "密碼錯誤。"
authenticationFailed: "驗證失敗。"
voteConfirm: "確定投給「{choice}」?"
hide: "隱藏"
useDrawerReactionPickerForMobile: "在移動設備上使用抽屜顯示"

View File

@ -122,10 +122,12 @@ export class SigninApiService {
return;
}
const loginWithEmail = username.includes('@');
// Fetch user
const profile = await this.userProfilesRepository.findOne({
relations: ['user'],
where: username.includes('@') ? {
where: loginWithEmail ? {
email: username,
emailVerified: true,
user: {
@ -143,21 +145,21 @@ export class SigninApiService {
if (!user || !profile) {
logger.error('No such user.');
return error(403, {
id: '932c904e-9460-45b7-9ce6-7ed33be7eb2c',
id: loginWithEmail ? '932c904e-9460-45b7-9ce6-7ed33be7eb2c' : '6cc579cc-885d-43d8-95c2-b8c7fc963280',
});
}
if (user.isDeleted && user.isSuspended) {
logger.error('No such user. (logical deletion)');
return error(403, {
id: '932c904e-9460-45b7-9ce6-7ed33be7eb2c',
id: loginWithEmail ? '932c904e-9460-45b7-9ce6-7ed33be7eb2c' : '6cc579cc-885d-43d8-95c2-b8c7fc963280',
});
}
if (user.isSuspended) {
logger.error('User is suspended.');
return error(403, {
id: 'e03a5f46-d309-4865-9b69-56282d94e1eb',
id: loginWithEmail ? '932c904e-9460-45b7-9ce6-7ed33be7eb2c' : 'e03a5f46-d309-4865-9b69-56282d94e1eb',
});
}
@ -180,27 +182,26 @@ export class SigninApiService {
if (!profile.twoFactorEnabled) {
if (process.env.NODE_ENV !== 'test') {
const meta = await this.metaService.fetch();
if (meta.enableHcaptcha && meta.hcaptchaSecretKey) {
await this.captchaService.verifyHcaptcha(meta.hcaptchaSecretKey, body['hcaptcha-response']).catch(err => {
throw new FastifyReplyError(400, err);
});
}
try {
if (meta.enableHcaptcha && meta.hcaptchaSecretKey) {
await this.captchaService.verifyHcaptcha(meta.hcaptchaSecretKey, body['hcaptcha-response']);
}
if (meta.enableMcaptcha && meta.mcaptchaSecretKey && meta.mcaptchaSitekey && meta.mcaptchaInstanceUrl) {
await this.captchaService.verifyMcaptcha(meta.mcaptchaSecretKey, meta.mcaptchaSitekey, meta.mcaptchaInstanceUrl, body['m-captcha-response']).catch(err => {
throw new FastifyReplyError(400, err);
});
}
if (meta.enableMcaptcha && meta.mcaptchaSecretKey && meta.mcaptchaSitekey && meta.mcaptchaInstanceUrl) {
await this.captchaService.verifyMcaptcha(meta.mcaptchaSecretKey, meta.mcaptchaSitekey, meta.mcaptchaInstanceUrl, body['m-captcha-response']);
}
if (meta.enableRecaptcha && meta.recaptchaSecretKey) {
await this.captchaService.verifyRecaptcha(meta.recaptchaSecretKey, body['g-recaptcha-response']).catch(err => {
throw new FastifyReplyError(400, err);
});
}
if (meta.enableRecaptcha && meta.recaptchaSecretKey) {
await this.captchaService.verifyRecaptcha(meta.recaptchaSecretKey, body['g-recaptcha-response']);
}
if (meta.enableTurnstile && meta.turnstileSecretKey) {
await this.captchaService.verifyTurnstile(meta.turnstileSecretKey, body['turnstile-response']).catch(err => {
throw new FastifyReplyError(400, err);
if (meta.enableTurnstile && meta.turnstileSecretKey) {
await this.captchaService.verifyTurnstile(meta.turnstileSecretKey, body['turnstile-response']);
}
} catch (err) {
logger.error(`Invalid request: captcha verification failed: ${err}`);
return await fail(403, {
id: '932c904e-9460-45b7-9ce6-7ed33be7eb2c',
});
}
}
@ -229,7 +230,7 @@ export class SigninApiService {
} catch (e) {
logger.error('Invalid request: Unable to authenticate with two-factor token.');
return await fail(403, {
id: 'cdf1235b-ac71-46d4-a3a6-84ccce48df6f',
id: '932c904e-9460-45b7-9ce6-7ed33be7eb2c',
});
}
@ -251,7 +252,7 @@ export class SigninApiService {
} else {
logger.error('Invalid request: Unable to authenticate with WebAuthn credential.');
return await fail(403, {
id: '93b86c4b-72f9-40eb-9815-798928603d1e',
id: '932c904e-9460-45b7-9ce6-7ed33be7eb2c',
});
}
} else {

View File

@ -241,7 +241,7 @@ function loginFailed(err: any): void {
os.alert({
type: 'error',
title: i18n.ts.loginFailed,
text: i18n.ts.incorrectPassword,
text: i18n.ts.authenticationFailed,
});
break;
}