From 40fd420b67d82c838f5353e4464ffc7882185601 Mon Sep 17 00:00:00 2001 From: user Date: Sun, 11 Aug 2024 16:15:02 +0300 Subject: [PATCH] fix auth misprint --- app/api/routes/auth.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/api/routes/auth.py b/app/api/routes/auth.py index e88726b..b879ce4 100644 --- a/app/api/routes/auth.py +++ b/app/api/routes/auth.py @@ -52,12 +52,12 @@ async def s_api_v1_auth_twa(request): wallet_info.account = Account.from_dict(auth_data['ton_proof']['account']) wallet_info.ton_proof = TonProof.from_dict({'proof': auth_data['ton_proof']['ton_proof']}) connection_payload = auth_data['ton_proof']['ton_proof']['payload'] - known_payload = (await request.ctx.db_session.execute(select(KnownKey).where(KnownKey.seed == connection_payload))).scalars().first() + known_payload = (request.ctx.db_session.execute(select(KnownKey).where(KnownKey.seed == connection_payload))).scalars().first() assert known_payload, "Unknown payload" assert known_payload.meta['I_user_id'] == known_user.id, "Invalid user_id" assert wallet_info.check_proof(connection_payload), "Invalid proof" - for known_connection in (await request.ctx.db_session.execute(select(WalletConnection).where( + for known_connection in (request.ctx.db_session.execute(select(WalletConnection).where( and_( WalletConnection.user_id == known_user.id, WalletConnection.network == 'ton' @@ -65,7 +65,7 @@ async def s_api_v1_auth_twa(request): ))).scalars().all(): known_connection.invalidated = True - for other_connection in (await request.ctx.db_session.execute(select(WalletConnection).where( + for other_connection in (request.ctx.db_session.execute(select(WalletConnection).where( WalletConnection.wallet_address == Address(wallet_info.account.address).to_string(1, 1, 1) ))).scalars().all(): other_connection.invalidated = True @@ -86,7 +86,7 @@ async def s_api_v1_auth_twa(request): without_pk=False ) request.ctx.db_session.add(new_connection) - await request.ctx.db_session.commit() + request.ctx.db_session.commit() except BaseException as e: make_log("auth", f"Invalid ton_proof: {e}", level="warning") return response.json({"error": "Invalid ton_proof"}, status=400)