From a0ffcf0f867dc4d08382da36e7185c9e2c40d5f6 Mon Sep 17 00:00:00 2001 From: sdarbinyan Date: Fri, 15 May 2026 13:41:11 +0400 Subject: [PATCH] checking auth --- .../pages/fastcheck-page/fastcheck-page.html | 4 ++- .../pages/fastcheck-page/fastcheck-page.ts | 29 +++++++++++++++++-- 2 files changed, 29 insertions(+), 4 deletions(-) diff --git a/src/app/pages/fastcheck-page/fastcheck-page.html b/src/app/pages/fastcheck-page/fastcheck-page.html index 8e1a261..2beb3da 100644 --- a/src/app/pages/fastcheck-page/fastcheck-page.html +++ b/src/app/pages/fastcheck-page/fastcheck-page.html @@ -32,7 +32,9 @@ autocomplete="off" maxlength="20" /> - {{ 'fastcheck.number_new' | translate }} + diff --git a/src/app/pages/fastcheck-page/fastcheck-page.ts b/src/app/pages/fastcheck-page/fastcheck-page.ts index 3bcb685..d1e7a43 100644 --- a/src/app/pages/fastcheck-page/fastcheck-page.ts +++ b/src/app/pages/fastcheck-page/fastcheck-page.ts @@ -97,6 +97,7 @@ export class FastcheckPage { webSessionId = signal(''); paid = signal(false); loginOnly = signal(false); + isNewFlow = signal(false); sessionToken = signal(localStorage.getItem('fc_session') ?? ''); private pollHandle: ReturnType | null = null; private lastLookedUpNumber = ''; @@ -276,6 +277,7 @@ export class FastcheckPage { if (!this.canPay()) return; this.error.set(''); this.loginOnly.set(false); + this.isNewFlow.set(false); this.openPopup(); } @@ -287,6 +289,7 @@ export class FastcheckPage { shareByTelegram(): void { if (!this.canShare()) return; this.error.set(''); + this.isNewFlow.set(false); const tg = this.telegramId(); if (tg) { @@ -299,6 +302,22 @@ export class FastcheckPage { this.openPopup(); } + createNewFastcheck(event: Event): void { + event.preventDefault(); + this.isNewFlow.set(true); + this.loginOnly.set(false); + this.openPopup(); + } + + private doRedirectToNew(): void { + const tok = this.webSessionId(); + if (tok) { + localStorage.setItem('fc_session', tok); + this.sessionToken.set(tok); + } + window.location.href = this.newQrUrl(); + } + /** POST /api/fastcheck/message/{telegramID} with all fastcheck fields. */ private sendFastcheckToTelegram(telegramId: string): void { const url = `${FASTCHECK_STORE_API}/fastcheck/message/${encodeURIComponent(telegramId)}`; @@ -334,7 +353,9 @@ export class FastcheckPage { if (res?.Status) { this.popupLoading.set(false); this.webSessionId.set(existing); - if (this.loginOnly()) { + if (this.isNewFlow()) { + this.doRedirectToNew(); + } else if (this.loginOnly()) { this.paid.set(true); } else { this.acceptFastcheck(existing); @@ -373,7 +394,7 @@ export class FastcheckPage { closePopup(): void { this.popupOpen.set(false); this.stopPolling(); - if (this.loginOnly() && this.paid()) { + if ((this.loginOnly() || this.isNewFlow()) && this.paid()) { // Keep session alive — user is logged in, preserve token for next action. const tok = this.webSessionId(); localStorage.setItem('fc_session', tok); @@ -400,7 +421,9 @@ export class FastcheckPage { next: (res) => { if (res?.Status) { this.stopPolling(); - if (this.loginOnly()) { + if (this.isNewFlow()) { + this.doRedirectToNew(); + } else if (this.loginOnly()) { // Identified — use userId as telegramID and send the fastcheck. const tg = res.userId || res.userSessionId || ''; if (tg) {