feat: localize login page
This commit is contained in:
@@ -369,6 +369,16 @@ var TRANSLATIONS = {
|
||||
'login.password': 'Password',
|
||||
'login.submit': 'Sign in',
|
||||
'login.sso': 'Continue with Google',
|
||||
'login.email_label': 'Email address',
|
||||
'login.email_placeholder': 'you@acme.com',
|
||||
'login.forgot': 'Forgot password?',
|
||||
'login.divider': 'or continue with',
|
||||
'login.sso_short': 'Google SSO',
|
||||
'login.request_prefix': "Don't have an account?",
|
||||
'login.request_link': 'Request access',
|
||||
'login.error.required': 'Please enter your email and password.',
|
||||
'login.error.invalid': 'Invalid email or password. Please try again.',
|
||||
'login.error.generic': 'Unable to sign in right now. Please try again.',
|
||||
},
|
||||
|
||||
ru: {
|
||||
@@ -736,6 +746,16 @@ var TRANSLATIONS = {
|
||||
'login.password': 'Пароль',
|
||||
'login.submit': 'Войти',
|
||||
'login.sso': 'Войти через Google',
|
||||
'login.email_label': 'Email адрес',
|
||||
'login.email_placeholder': 'you@acme.com',
|
||||
'login.forgot': 'Забыли пароль?',
|
||||
'login.divider': 'или продолжить через',
|
||||
'login.sso_short': 'Google SSO',
|
||||
'login.request_prefix': 'Нет аккаунта?',
|
||||
'login.request_link': 'Запросить доступ',
|
||||
'login.error.required': 'Введите email и пароль.',
|
||||
'login.error.invalid': 'Неверный email или пароль. Попробуйте еще раз.',
|
||||
'login.error.generic': 'Сейчас не удается войти. Попробуйте еще раз.',
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
+7
-3
@@ -1,4 +1,8 @@
|
||||
(function() {
|
||||
function tKey(key) {
|
||||
return window.t ? t(key) : key;
|
||||
}
|
||||
|
||||
function showError(message) {
|
||||
var errorElement = document.getElementById('login-error');
|
||||
errorElement.style.display = 'block';
|
||||
@@ -22,7 +26,7 @@
|
||||
var password = document.getElementById('password').value;
|
||||
|
||||
if (!email || !password) {
|
||||
showError('Please enter your email and password.');
|
||||
showError(tKey('login.error.required'));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -32,10 +36,10 @@
|
||||
await window.CrankAuth.login(email, password);
|
||||
} catch (error) {
|
||||
if (error && error.status === 401) {
|
||||
showError('Invalid email or password. Please try again.');
|
||||
showError(tKey('login.error.invalid'));
|
||||
return;
|
||||
}
|
||||
showError('Unable to sign in right now. Please try again.');
|
||||
showError(tKey('login.error.generic'));
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user