mirror of
https://github.com/MacRimi/ProxMenux.git
synced 2026-08-06 15:56:23 +00:00
fix(i18n): localize login error messages
This commit is contained in:
@@ -82,14 +82,20 @@ export function Login({ onLogin }: LoginProps) {
|
||||
|
||||
const data = await response.json()
|
||||
|
||||
if (data.requires_totp) {
|
||||
if (response.ok && data.requires_totp) {
|
||||
setRequiresTotp(true)
|
||||
setLoading(false)
|
||||
return
|
||||
}
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error(data.message || t("login.loginFailed"))
|
||||
if (response.status === 429) {
|
||||
throw new Error(t("login.tooManyAttempts"))
|
||||
}
|
||||
if (response.status === 401) {
|
||||
throw new Error(data.requires_totp ? t("login.invalidTotp") : t("login.invalidCredentials"))
|
||||
}
|
||||
throw new Error(t("login.loginFailed"))
|
||||
}
|
||||
|
||||
localStorage.setItem("proxmenux-auth-token", data.token)
|
||||
|
||||
@@ -1402,6 +1402,9 @@
|
||||
"rememberMe": "Remember me",
|
||||
"missingCredentials": "Please enter username and password",
|
||||
"missingTotp": "Please enter your 2FA code",
|
||||
"invalidCredentials": "Incorrect username or password",
|
||||
"invalidTotp": "Incorrect 2FA code",
|
||||
"tooManyAttempts": "Too many login attempts. Please wait a moment and try again.",
|
||||
"loginFailed": "Login failed",
|
||||
"signingIn": "Signing in...",
|
||||
"signIn": "Sign In",
|
||||
|
||||
@@ -1402,6 +1402,9 @@
|
||||
"rememberMe": "Zapamätať si ma",
|
||||
"missingCredentials": "Zadajte používateľské meno aj heslo",
|
||||
"missingTotp": "Zadajte 2FA kód",
|
||||
"invalidCredentials": "Nesprávne používateľské meno alebo heslo",
|
||||
"invalidTotp": "Nesprávny 2FA kód",
|
||||
"tooManyAttempts": "Príliš veľa pokusov o prihlásenie. Chvíľu počkajte a skúste to znova.",
|
||||
"loginFailed": "Prihlásenie zlyhalo",
|
||||
"signingIn": "Prihlasujem...",
|
||||
"signIn": "Prihlásiť sa",
|
||||
|
||||
Reference in New Issue
Block a user