SHA256
Добавить согласие с лицензиями перед регистрацией
This commit is contained in:
@@ -338,7 +338,8 @@ export function render({ navigate }) {
|
||||
function finishIdentity(status) {
|
||||
try {
|
||||
savePendingHeaderIdentity(draft.login, draft.preGeneratedKeyBundle?.blockchainPair?.publicKeyB64, draft);
|
||||
navigate(flowType === 'free' ? 'registration-email-view' : 'registration-payment-view');
|
||||
draft.licensesAccepted = false;
|
||||
navigate('registration-licenses-view');
|
||||
} catch (error) { status.textContent = error.message; }
|
||||
}
|
||||
|
||||
|
||||
@@ -12,6 +12,9 @@ export function render({ navigate }) {
|
||||
const form = document.createElement('div');
|
||||
form.className = 'card stack registration-form signup-wizard__body';
|
||||
const draft = state.registrationDraft;
|
||||
if (!state.registrationDraft.licensesAccepted) {
|
||||
queueMicrotask(() => navigate('registration-licenses-view')); return screen;
|
||||
}
|
||||
if (![0, 1].includes(draft.accountType) || !draft.preGeneratedKeyBundle) {
|
||||
queueMicrotask(() => navigate('register-view')); return screen;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
import { t } from '../i18n/index.js';
|
||||
import { createTopBar } from '../components/topbar.js';
|
||||
import { state } from '../state.js';
|
||||
|
||||
const LICENSES = [
|
||||
{ name: 'CC BY-NC 4.0', original: 'https://arweave.net/Xtym3vUAyt7OgFBINBh1ene-5360Ah76c6D-O9ywxVE', russian: 'https://creativecommons.org/licenses/by-nc/4.0/legalcode.ru' },
|
||||
{ name: 'SCDL 1.0', original: 'https://arweave.net/NPckIo-nQUP2-ZM6PIoDYnx-6wwLeErH39jXCddOxPE', russian: './static-sites/licenses/SHiNE-SCDL-1.0-ru.html' },
|
||||
];
|
||||
|
||||
export const pageMeta = { id: 'registration-licenses-view', get title() { return t('screens.registration_licenses.title'); }, showAppChrome: false };
|
||||
|
||||
export function render({ navigate }) {
|
||||
const draft = state.registrationDraft;
|
||||
const screen = document.createElement('section');
|
||||
screen.className = 'stack registration-screen signup-wizard';
|
||||
if (!['free', 'paid'].includes(draft.flowType) || !draft.login || !draft.preGeneratedKeyBundle || ![0, 1].includes(draft.accountType)) {
|
||||
queueMicrotask(() => navigate('register-view'));
|
||||
return screen;
|
||||
}
|
||||
const body = document.createElement('div');
|
||||
body.className = 'card stack registration-form signup-wizard__body';
|
||||
const back = () => navigate('register-view');
|
||||
screen.append(createTopBar({ title: t('screens.registration_licenses.title'), back: { label: '←', onClick: back } }), body);
|
||||
const heading = document.createElement('h1'); heading.className = 'signup-title'; heading.textContent = t('screens.registration_licenses.title'); body.append(heading);
|
||||
const paragraph = (key, className = '') => { const p = document.createElement('p'); if (className) p.className = className; p.textContent = t(`screens.registration_licenses.${key}`); body.append(p); };
|
||||
paragraph('intro'); paragraph('rights');
|
||||
for (const [index, license] of LICENSES.entries()) {
|
||||
const title = document.createElement('h2'); title.textContent = license.name; body.append(title);
|
||||
paragraph(index === 0 ? 'cc_description' : 'scdl_description');
|
||||
const links = document.createElement('p'); links.className = 'signup-guidance';
|
||||
const original = document.createElement('a'); original.href = license.original; original.target = '_blank'; original.rel = 'noopener noreferrer'; original.textContent = t('screens.registration_licenses.original');
|
||||
const russian = document.createElement('a'); russian.href = license.russian; russian.target = '_blank'; russian.rel = 'noopener noreferrer'; russian.textContent = t('screens.registration_licenses.russian');
|
||||
links.append(original, document.createTextNode(' · '), russian); body.append(links);
|
||||
}
|
||||
const important = document.createElement('h2'); important.textContent = t('screens.registration_licenses.important'); body.append(important);
|
||||
const list = document.createElement('ul');
|
||||
for (const key of ['copyright', 'irrevocable', 'permanent', 'owned_rights', 'private_messages']) {
|
||||
const item = document.createElement('li'); item.textContent = t(`screens.registration_licenses.${key}`); list.append(item);
|
||||
}
|
||||
body.append(list);
|
||||
paragraph('confirmation'); paragraph('signature');
|
||||
const accept = document.createElement('button'); accept.type = 'button'; accept.className = 'primary-btn signup-next'; accept.textContent = t('screens.registration_licenses.accept');
|
||||
accept.addEventListener('click', () => { draft.licensesAccepted = true; navigate(draft.flowType === 'free' ? 'registration-email-view' : 'registration-payment-view'); });
|
||||
body.append(accept);
|
||||
return screen;
|
||||
}
|
||||
@@ -92,6 +92,7 @@ function clamp(value, min, max) {
|
||||
|
||||
export async function completeRegistrationLogin({ navigate, keyBundle }) {
|
||||
const draft = state.registrationDraft;
|
||||
if (!draft.licensesAccepted) throw new Error('Registration licenses not accepted');
|
||||
if (![0, 1].includes(draft.accountType)) throw new Error('Missing registration account type');
|
||||
// Финальный вход регистрации нельзя повторять на сокете, который мог
|
||||
// стать авторизованным после частично успешной предыдущей попытки.
|
||||
@@ -168,6 +169,9 @@ export async function completeRegistrationLogin({ navigate, keyBundle }) {
|
||||
export function render({ navigate }) {
|
||||
const screen = document.createElement('section');
|
||||
screen.className = 'stack';
|
||||
if (!state.registrationDraft.licensesAccepted) {
|
||||
queueMicrotask(() => navigate('registration-licenses-view')); return screen;
|
||||
}
|
||||
if (![0, 1].includes(state.registrationDraft.accountType) || !state.registrationDraft.preGeneratedKeyBundle) {
|
||||
queueMicrotask(() => navigate('register-view')); return screen;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user