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()
|
const data = await response.json()
|
||||||
|
|
||||||
if (data.requires_totp) {
|
if (response.ok && data.requires_totp) {
|
||||||
setRequiresTotp(true)
|
setRequiresTotp(true)
|
||||||
setLoading(false)
|
setLoading(false)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!response.ok) {
|
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)
|
localStorage.setItem("proxmenux-auth-token", data.token)
|
||||||
|
|||||||
@@ -1402,6 +1402,9 @@
|
|||||||
"rememberMe": "Remember me",
|
"rememberMe": "Remember me",
|
||||||
"missingCredentials": "Please enter username and password",
|
"missingCredentials": "Please enter username and password",
|
||||||
"missingTotp": "Please enter your 2FA code",
|
"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",
|
"loginFailed": "Login failed",
|
||||||
"signingIn": "Signing in...",
|
"signingIn": "Signing in...",
|
||||||
"signIn": "Sign In",
|
"signIn": "Sign In",
|
||||||
|
|||||||
@@ -1402,6 +1402,9 @@
|
|||||||
"rememberMe": "Zapamätať si ma",
|
"rememberMe": "Zapamätať si ma",
|
||||||
"missingCredentials": "Zadajte používateľské meno aj heslo",
|
"missingCredentials": "Zadajte používateľské meno aj heslo",
|
||||||
"missingTotp": "Zadajte 2FA kód",
|
"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",
|
"loginFailed": "Prihlásenie zlyhalo",
|
||||||
"signingIn": "Prihlasujem...",
|
"signingIn": "Prihlasujem...",
|
||||||
"signIn": "Prihlásiť sa",
|
"signIn": "Prihlásiť sa",
|
||||||
|
|||||||
Reference in New Issue
Block a user