Очистить устаревший черновик регистрации

This commit is contained in:
AidarKC
2026-11-16 10:59:27 +03:00
parent 1b86bca19a
commit 102feccb2e
7 changed files with 71 additions and 72 deletions
+7 -10
View File
@@ -3,7 +3,7 @@ import { createTopBar } from '../components/topbar.js';
import { createVisiblePasswordField } from '../components/visible-password-field.js';
import { confirmPasswordBoundarySpaces } from '../services/password-boundary-warning.js';
import { createRegistrationStepper } from '../components/registration-stepper.js';
import { authService, clearAuthMessages, state } from '../state.js';
import { authService, clearAuthMessages, clearRegistrationDraft, state } from '../state.js';
import { PASSWORD_MAX_LENGTH } from '../services/password-words.js';
import { getRegistrationNamespaces, checkRegistrationLogin } from '../services/registration-v2-api.js';
import { normalizeFullLogin } from '../services/shine-namespace-service.js';
@@ -118,11 +118,7 @@ export function render({ navigate }) {
if (Number(available.currencyCode ?? 1) !== 1 || Number(ns.currencyCode ?? 1) !== 1) throw new Error(t('screens.register_view.text_025'));
if (draft.login !== login) {
if (!confirmFundedWalletChange()) return;
state.registrationPayment.walletAddress = '';
state.registrationPayment.balanceSOL = '0.0000';
draft.preGeneratedKeyBundle = null;
draft.challengeId = '';
draft.challengeExpiresAtMs = 0;
clearRegistrationDraft({ preserveFlowType: true });
}
draft.login = login;
draft.namespaceFeeLamports = String(available.registrationFeeLamports ?? ns.registrationFeeLamports ?? 0);
@@ -184,10 +180,11 @@ export function render({ navigate }) {
if (warningRevision !== inputRevision || input.value !== value) { status.textContent = t('screens.register_view.text_012'); return; }
if (draft.password && draft.password !== value && !confirmFundedWalletChange()) return;
if (draft.password && draft.password !== value) {
state.registrationPayment.walletAddress = '';
state.registrationPayment.balanceSOL = '0.0000';
draft.challengeId = '';
draft.challengeExpiresAtMs = 0;
clearRegistrationDraft({
preserveFlowType: true,
preserveLogin: true,
preserveNamespace: true,
});
}
const revision = inputRevision;
const thisRequest = ++requestId;