SHA256
Регистрация: бесплатная регистрация работает
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { createTopBar } from '../components/topbar.js';
|
||||
import { state } from '../state.js';
|
||||
import { authService, state } from '../state.js';
|
||||
import { checkRegistrationEmail, startFreeRegistration, confirmFreeRegistration } from '../services/registration-v2-api.js';
|
||||
import { completeRegistrationLogin } from './registration-payment-view.js';
|
||||
|
||||
@@ -24,13 +24,18 @@ export function render({navigate}) {
|
||||
let disposed=false;
|
||||
function showConfirm(){ input.disabled=true;next.hidden=true;code.hidden=false;codeLabel.hidden=false;confirm.hidden=false;retry.hidden=false; }
|
||||
next.addEventListener('click',async()=>{
|
||||
if(!draft.preGeneratedKeyBundle || draft.flowType!=='free'){status.textContent='Сначала подготовьте ключи на предыдущем экране';return;}
|
||||
if(draft.flowType!=='free'){status.textContent='Выберите бесплатную регистрацию на предыдущем экране';return;}
|
||||
next.disabled=true;status.textContent='Проверяем email…';
|
||||
try {
|
||||
const address=input.value.trim();
|
||||
const available=await checkRegistrationEmail(address);
|
||||
if(!available.emailAvailable) throw new Error('Этот email уже использован для бесплатной регистрации');
|
||||
draft.email=address;
|
||||
if(!draft.preGeneratedKeyBundle){
|
||||
if(!draft.login || !draft.password) throw new Error('Логин или пароль не сохранены. Вернитесь на предыдущий экран.');
|
||||
status.textContent='Создаём ключи локально (Argon2id)…';
|
||||
draft.preGeneratedKeyBundle=await authService.derivePasswordKeyBundle(draft.login,draft.password);
|
||||
}
|
||||
status.textContent='Создаём временную заявку…';
|
||||
const started=await startFreeRegistration({fullLogin:draft.login,keyBundle:draft.preGeneratedKeyBundle,email:address});
|
||||
if(disposed)return;
|
||||
|
||||
Reference in New Issue
Block a user