SHA256
Отключить мультиаккаунтность и уточнить статусы профиля
This commit is contained in:
@@ -37,6 +37,10 @@ export function render({ navigate }) {
|
||||
return window.confirm(t('screens.register_view.text_039'));
|
||||
}
|
||||
function goBack() {
|
||||
if (Number(draft.uiStep) === 4) {
|
||||
showAccountType();
|
||||
return;
|
||||
}
|
||||
if (Number(draft.uiStep) === 3) {
|
||||
showPassword();
|
||||
return;
|
||||
@@ -70,7 +74,7 @@ export function render({ navigate }) {
|
||||
}
|
||||
function showLogin() {
|
||||
draft.uiStep = 1;
|
||||
body.replaceChildren(createRegistrationStepper(1));
|
||||
body.replaceChildren(createRegistrationStepper(1, draft.accountType === 1 ? 5 : 4));
|
||||
const [heading, description] = title(t('screens.register_view.text_014'), t('screens.register_view.text_015'));
|
||||
const label = document.createElement('label');
|
||||
label.className = 'stack';
|
||||
@@ -143,7 +147,7 @@ export function render({ navigate }) {
|
||||
}
|
||||
function showPassword() {
|
||||
draft.uiStep = 2;
|
||||
body.replaceChildren(createRegistrationStepper(2));
|
||||
body.replaceChildren(createRegistrationStepper(2, draft.accountType === 1 ? 5 : 4));
|
||||
const [heading, description] = title(t('screens.register_view.text_016'), t('screens.register_view.text_017'));
|
||||
const label = document.createElement('label');
|
||||
label.className = 'stack';
|
||||
@@ -238,7 +242,7 @@ export function render({ navigate }) {
|
||||
|
||||
function showAccountType() {
|
||||
draft.uiStep = 3;
|
||||
body.replaceChildren(createRegistrationStepper(3));
|
||||
body.replaceChildren(createRegistrationStepper(3, draft.accountType === 1 ? 5 : 4));
|
||||
const tr = key => t(`screens.registration_identity.${key}`);
|
||||
const [heading, description] = title(tr('title'), tr('immutable'));
|
||||
const choices = document.createElement('div'); choices.className = 'stack';
|
||||
@@ -249,12 +253,33 @@ export function render({ navigate }) {
|
||||
const titleRow = document.createElement('strong'); titleRow.append(radio, ' ' + tr(name));
|
||||
const p = document.createElement('p'); p.textContent = tr(detail);
|
||||
label.append(titleRow, p); choices.append(label);
|
||||
radio.addEventListener('change', () => { draft.accountType = type; refresh(); });
|
||||
radio.addEventListener('change', () => { draft.accountType = type; next.disabled = false; body.firstElementChild.replaceWith(createRegistrationStepper(3, type === 1 ? 5 : 4)); });
|
||||
};
|
||||
option(1, 'primary', 'primary_detail');
|
||||
option(0, 'alternative', 'alternative_detail');
|
||||
const status = statusLine();
|
||||
const next = document.createElement('button'); next.type = 'button'; next.className = 'primary-btn signup-next'; next.textContent = tr('next');
|
||||
next.disabled = ![0, 1].includes(draft.accountType);
|
||||
next.addEventListener('click', () => {
|
||||
if (draft.accountType === 1) showPreviousAccounts();
|
||||
else if (draft.accountType === 0) { draft.previousAccounts = []; finishIdentity(status); }
|
||||
});
|
||||
body.append(heading, description, choices, status, next);
|
||||
}
|
||||
|
||||
function finishIdentity(status) {
|
||||
try {
|
||||
savePendingHeaderIdentity(draft.login, draft.preGeneratedKeyBundle?.blockchainPair?.publicKeyB64, draft);
|
||||
navigate(flowType === 'free' ? 'registration-email-view' : 'registration-payment-view');
|
||||
} catch (error) { status.textContent = error.message; }
|
||||
}
|
||||
|
||||
function showPreviousAccounts() {
|
||||
draft.uiStep = 4;
|
||||
body.replaceChildren(createRegistrationStepper(4, 5));
|
||||
const tr = key => t(`screens.registration_identity.${key}`);
|
||||
const [heading, description] = title(tr('previous_title'), tr('previous_detail'));
|
||||
const previous = document.createElement('div'); previous.className = 'stack';
|
||||
const explanation = document.createElement('p'); explanation.textContent = tr('previous_detail');
|
||||
const disclosure = document.createElement('p'); disclosure.className = 'signup-guidance'; disclosure.textContent = tr('disclosure');
|
||||
const list = document.createElement('div'); list.className = 'stack';
|
||||
const add = document.createElement('button'); add.type = 'button'; add.className = 'secondary-btn'; add.textContent = tr('add');
|
||||
@@ -264,12 +289,10 @@ export function render({ navigate }) {
|
||||
const results = document.createElement('div'); results.className = 'stack';
|
||||
const status = statusLine();
|
||||
searchBox.append(input, search, results);
|
||||
previous.append(explanation, list, add, searchBox, disclosure);
|
||||
previous.append(list, add, searchBox, disclosure);
|
||||
const next = document.createElement('button'); next.type = 'button'; next.className = 'primary-btn signup-next'; next.textContent = tr('next');
|
||||
let queryRevision = 0;
|
||||
function refresh() {
|
||||
previous.hidden = draft.accountType !== 1;
|
||||
next.disabled = draft.accountType === null;
|
||||
list.replaceChildren();
|
||||
for (const login of draft.previousAccounts) {
|
||||
const row = document.createElement('div'); row.className = 'signup-full-login';
|
||||
@@ -289,7 +312,7 @@ export function render({ navigate }) {
|
||||
const revision = ++queryRevision; results.replaceChildren(); status.textContent = '';
|
||||
try {
|
||||
const users = await authService.searchPeople(query, { limit: 20 });
|
||||
if (!screen.isConnected || draft.uiStep !== 3 || revision !== queryRevision || draft.accountType !== 1) return;
|
||||
if (!screen.isConnected || draft.uiStep !== 4 || revision !== queryRevision || draft.accountType !== 1) return;
|
||||
const seen = new Set([draft.login, ...draft.previousAccounts].map(v => v.toLowerCase()));
|
||||
for (const user of users) {
|
||||
const login = String(user?.login || '');
|
||||
@@ -306,22 +329,16 @@ export function render({ navigate }) {
|
||||
if (!results.childElementCount) status.textContent = tr('not_found');
|
||||
} catch (error) { if (screen.isConnected && revision === queryRevision) status.textContent = error.message || tr('search_error'); }
|
||||
});
|
||||
next.addEventListener('click', () => {
|
||||
if (![0, 1].includes(draft.accountType)) return;
|
||||
try {
|
||||
if (draft.accountType === 0) draft.previousAccounts = [];
|
||||
savePendingHeaderIdentity(draft.login, draft.preGeneratedKeyBundle?.blockchainPair?.publicKeyB64, draft);
|
||||
navigate(flowType === 'free' ? 'registration-email-view' : 'registration-payment-view');
|
||||
} catch (error) { status.textContent = error.message; }
|
||||
});
|
||||
body.append(heading, description, choices, previous, status, next); refresh();
|
||||
next.addEventListener('click', () => finishIdentity(status));
|
||||
body.append(heading, description, previous, status, next); refresh();
|
||||
}
|
||||
|
||||
if (flowType !== 'free' && flowType !== 'paid') {
|
||||
queueMicrotask(() => navigate('registration-choice-view'));
|
||||
return screen;
|
||||
}
|
||||
if (Number(draft.uiStep) === 3 && draft.login && draft.preGeneratedKeyBundle) showAccountType();
|
||||
if (Number(draft.uiStep) === 4 && draft.accountType === 1 && draft.login && draft.preGeneratedKeyBundle) showPreviousAccounts();
|
||||
else if (Number(draft.uiStep) === 3 && draft.login && draft.preGeneratedKeyBundle) showAccountType();
|
||||
else if (Number(draft.uiStep) === 2 && draft.login) showPassword();
|
||||
else showLogin();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user