SHA256
Локализовать интерфейс SHiNE на русский и английский
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import { t } from '../i18n/index.js';
|
||||
import { createTopBar } from '../components/topbar.js';
|
||||
import { createVisiblePasswordField } from '../components/visible-password-field.js';
|
||||
import {
|
||||
@@ -15,7 +16,7 @@ import { toUserMessage } from '../services/ui-error-texts.js';
|
||||
import { clearStoredMessages } from '../services/message-store.js';
|
||||
import { emptyPasswordWords, PASSWORD_MAX_LENGTH } from '../services/password-words.js';
|
||||
|
||||
export const pageMeta = { id: 'login-password-view', title: 'Введите пароль', showAppChrome: false };
|
||||
export const pageMeta = { id: 'login-password-view', get title() { return t('screens.login_password_view.text_001'); }, showAppChrome: false };
|
||||
|
||||
function setStatus(statusEl, message) {
|
||||
statusEl.textContent = message;
|
||||
@@ -36,7 +37,7 @@ function createSecretOverlay() {
|
||||
|
||||
const title = document.createElement('div');
|
||||
title.className = 'secret-generation-title';
|
||||
title.textContent = 'Генерируем секрет…';
|
||||
title.textContent = t('screens.login_password_view.text_002');
|
||||
|
||||
const progress = document.createElement('div');
|
||||
progress.className = 'secret-generation-progress';
|
||||
@@ -63,7 +64,7 @@ export function render({ navigate }) {
|
||||
|
||||
const title = document.createElement('h1');
|
||||
title.className = 'login-panel-title';
|
||||
title.textContent = 'Введите пароль';
|
||||
title.textContent = t('screens.login_password_view.text_003');
|
||||
|
||||
const passwordField = document.createElement('label');
|
||||
passwordField.className = 'stack';
|
||||
@@ -76,7 +77,7 @@ export function render({ navigate }) {
|
||||
passwordInput.autocapitalize = 'off';
|
||||
passwordInput.spellcheck = false;
|
||||
passwordInput.maxLength = PASSWORD_MAX_LENGTH;
|
||||
passwordInput.placeholder = 'Пароль';
|
||||
passwordInput.placeholder = t('screens.login_password_view.text_004');
|
||||
passwordInput.value = '';
|
||||
|
||||
passwordField.append(createVisiblePasswordField(passwordInput));
|
||||
@@ -88,7 +89,7 @@ export function render({ navigate }) {
|
||||
const enterButton = document.createElement('button');
|
||||
enterButton.className = 'primary-btn';
|
||||
enterButton.type = 'button';
|
||||
enterButton.textContent = 'Войти';
|
||||
enterButton.textContent = t('screens.login_password_view.text_005');
|
||||
|
||||
const actions = document.createElement('div');
|
||||
actions.className = 'auth-footer-actions';
|
||||
@@ -106,7 +107,7 @@ export function render({ navigate }) {
|
||||
return;
|
||||
}
|
||||
if (password.length > PASSWORD_MAX_LENGTH) {
|
||||
setStatus(status, `Пароль слишком длинный. Максимальная длина: ${PASSWORD_MAX_LENGTH} символов.`);
|
||||
setStatus(status, t('screens.login_password_view.text_009', { value1: PASSWORD_MAX_LENGTH }));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -138,7 +139,7 @@ export function render({ navigate }) {
|
||||
});
|
||||
overlay.style.display = 'none';
|
||||
|
||||
enterButton.textContent = 'Проверяем пароль…';
|
||||
enterButton.textContent = t('screens.login_password_view.text_006');
|
||||
const result = await authService.createAuthSession(currentLogin, keyBundle);
|
||||
|
||||
// В текущей модели оба рабочих ключа всегда сохраняются автоматически.
|
||||
@@ -166,18 +167,18 @@ export function render({ navigate }) {
|
||||
state.registrationDraft.pendingSessionMaterial = null;
|
||||
|
||||
await refreshSessions();
|
||||
setAuthInfo(`Вы вошли как ${result.login}.`);
|
||||
setAuthInfo(t('screens.login_password_view.text_010', { value1: result.login }));
|
||||
navigate(consumeAuthReturnPage('profile-view'));
|
||||
} catch (error) {
|
||||
overlay.style.display = 'none';
|
||||
const message = toUserMessage(error, 'Не удалось выполнить вход.');
|
||||
const message = toUserMessage(error, t('screens.login_password_view.text_008'));
|
||||
setAuthError(message);
|
||||
setStatus(status, message);
|
||||
passwordInput.select();
|
||||
} finally {
|
||||
setAuthBusy(false);
|
||||
enterButton.disabled = false;
|
||||
enterButton.textContent = 'Войти';
|
||||
enterButton.textContent = t('screens.login_password_view.text_007');
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user