From 7848587136dd24c68d13c7614d4e36a0a3c0c479 Mon Sep 17 00:00:00 2001 From: Aevann Date: Thu, 31 Aug 2023 12:16:10 +0300 Subject: [PATCH] remove code that wasnt working --- files/routes/oauth.py | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/files/routes/oauth.py b/files/routes/oauth.py index ae16109666..421b281c59 100644 --- a/files/routes/oauth.py +++ b/files/routes/oauth.py @@ -31,13 +31,8 @@ def authorize(v): return {"oauth_error": "Invalid `client_id`"}, 400 access_token = secrets.token_urlsafe(128)[:128] - try: - new_auth = ClientAuth(oauth_client = application.id, user_id = v.id, access_token=access_token) - g.db.add(new_auth) - except sqlalchemy.exc.IntegrityError: - g.db.rollback() - old_auth = g.db.query(ClientAuth).filter_by(oauth_client = application.id, user_id = v.id).one() - access_token = old_auth.access_token + new_auth = ClientAuth(oauth_client = application.id, user_id = v.id, access_token=access_token) + g.db.add(new_auth) return redirect(f"{application.redirect_uri}?token={access_token}")