Теперь номера брутить чутка сложнее

This commit is contained in:
Alexey Polyakov 2026-03-10 19:06:41 +03:00
parent f07249e8fb
commit 39463b069b
1 changed files with 8 additions and 11 deletions

View File

@ -142,18 +142,15 @@ class Processors:
await cursor.execute("SELECT * FROM users WHERE phone = %s", (phone,)) await cursor.execute("SELECT * FROM users WHERE phone = %s", (phone,))
user = await cursor.fetchone() user = await cursor.fetchone()
# Если пользователя нет - отдаем ошибку # Если пользователя найден - сохраняем токен и отправляем код
if user is None: if user:
await self._send_error(seq, self.proto.AUTH_REQUEST, self.error_types.USER_NOT_FOUND, writer) # Сохраняем токен
return 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 = { payload = {
"requestMaxDuration": 60000, "requestMaxDuration": 60000,