From 39463b069bd1a30a87b356ad3237ce50367af231 Mon Sep 17 00:00:00 2001 From: Alexey Polyakov Date: Tue, 10 Mar 2026 19:06:41 +0300 Subject: [PATCH] =?UTF-8?q?=D0=A2=D0=B5=D0=BF=D0=B5=D1=80=D1=8C=20=D0=BD?= =?UTF-8?q?=D0=BE=D0=BC=D0=B5=D1=80=D0=B0=20=D0=B1=D1=80=D1=83=D1=82=D0=B8?= =?UTF-8?q?=D1=82=D1=8C=20=D1=87=D1=83=D1=82=D0=BA=D0=B0=20=D1=81=D0=BB?= =?UTF-8?q?=D0=BE=D0=B6=D0=BD=D0=B5=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/oneme_tcp/processors.py | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/src/oneme_tcp/processors.py b/src/oneme_tcp/processors.py index 687595f..05bf8de 100644 --- a/src/oneme_tcp/processors.py +++ b/src/oneme_tcp/processors.py @@ -142,18 +142,15 @@ class Processors: await cursor.execute("SELECT * FROM users WHERE phone = %s", (phone,)) user = await cursor.fetchone() - # Если пользователя нет - отдаем ошибку - if user is None: - await self._send_error(seq, self.proto.AUTH_REQUEST, self.error_types.USER_NOT_FOUND, writer) - return + # Если пользователя найден - сохраняем токен и отправляем код + if user: + # Сохраняем токен + await cursor.execute("INSERT INTO auth_tokens (phone, token_hash, code_hash, expires) VALUES (%s, %s, %s, %s)", (phone, token_hash, code_hash, expires,)) - # Сохраняем токен - await cursor.execute("INSERT INTO auth_tokens (phone, token_hash, code_hash, expires) VALUES (%s, %s, %s, %s)", (phone, token_hash, code_hash, expires,)) - - # Если тг бот включен, и тг привязан к аккаунту - отправляем туда сообщение - if self.telegram_bot and user.get("telegram_id"): - await self.telegram_bot.send_code(chat_id=int(user.get("telegram_id")), phone=phone, code=code) - + # Если тг бот включен, и тг привязан к аккаунту - отправляем туда сообщение + if self.telegram_bot and user.get("telegram_id"): + await self.telegram_bot.send_code(chat_id=int(user.get("telegram_id")), phone=phone, code=code) + # Данные пакета payload = { "requestMaxDuration": 60000,