SHA256
Исправить восстановление входа при занятом WebSocket
This commit is contained in:
@@ -175,9 +175,15 @@ export function render({ navigate }) {
|
||||
retry.disabled = true;
|
||||
status.textContent = t('screens.registration_email_view.text_022');
|
||||
try {
|
||||
const result = await confirmFreeRegistration(draft.challengeId, code.value.trim());
|
||||
// Подтверждение email идемпотентно на уровне сценария: после первого
|
||||
// успешного ответа повторяем только финальный вход, а не AuthChallenge
|
||||
// регистрации. Иначе предыдущий CreateAuthSession мог оставить сокет
|
||||
// авторизованным, и сервер вернёт ALREADY_AUTHED.
|
||||
if (!draft.dataItemId) {
|
||||
const result = await confirmFreeRegistration(draft.challengeId, code.value.trim());
|
||||
draft.dataItemId = result.dataItemId;
|
||||
}
|
||||
if (!screen.isConnected || disposed) return;
|
||||
draft.dataItemId = result.dataItemId;
|
||||
status.textContent = t('screens.registration_email_view.text_023');
|
||||
await completeRegistrationLogin({ navigate, keyBundle: draft.preGeneratedKeyBundle });
|
||||
} catch (error) {
|
||||
|
||||
@@ -91,7 +91,9 @@ function clamp(value, min, max) {
|
||||
}
|
||||
|
||||
export async function completeRegistrationLogin({ navigate, keyBundle }) {
|
||||
await authService.reconnect(state.entrySettings.shineServer);
|
||||
// Финальный вход регистрации нельзя повторять на сокете, который мог
|
||||
// стать авторизованным после частично успешной предыдущей попытки.
|
||||
authService.resetConnection(state.entrySettings.shineServer, { clearSessionContext: true });
|
||||
const result = await authService.createSessionForExistingUser(
|
||||
state.registrationDraft.login,
|
||||
state.registrationDraft.password,
|
||||
|
||||
Reference in New Issue
Block a user