From 9c358de03d0d7db2e865f358cd965ae580953878 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Tue, 3 Aug 2021 19:16:54 +0200 Subject: [PATCH] fdfd --- drama/helpers/wrappers.py | 6 ------ drama/routes/oauth.py | 9 +++------ drama/templates/settings_apps.html | 20 -------------------- 3 files changed, 3 insertions(+), 32 deletions(-) diff --git a/drama/helpers/wrappers.py b/drama/helpers/wrappers.py index c8ca9db22..82f0faca8 100644 --- a/drama/helpers/wrappers.py +++ b/drama/helpers/wrappers.py @@ -10,12 +10,6 @@ def get_logged_in_user(): token = request.headers.get("Authorization") if not token: return None, None - token = token.split() - if len(token) < 2: return None, None - - token = token[1] - if not token: return None, None - client = g.db.query(ClientAuth).filter(ClientAuth.access_token == token).first() x = (client.user, client) if client else (None, None) diff --git a/drama/routes/oauth.py b/drama/routes/oauth.py index 5b2885efe..c56b3efdf 100644 --- a/drama/routes/oauth.py +++ b/drama/routes/oauth.py @@ -10,18 +10,15 @@ from drama.__main__ import app def authorize_prompt(v): client_id = request.args.get("client_id") application = g.db.query(OauthApp).filter_by(client_id=client_id).first() - if not application: return {"oauth_error": "Invalid `client_id`"}, 401 if application.is_banned: return {"oauth_error": f"Application `{application.app_name}` is suspended."}, 403 - redirect_uri = request.args.get("redirect_uri") - if not redirect_uri: return {"oauth_error": f"`redirect_uri` must be provided."}, 400 - return render_template("oauth.html", v=v, application=application, redirect_uri=redirect_uri) + return render_template("oauth.html", v=v, application=application) @app.post("/authorize") @auth_required @validate_formkey -def oauth(v): +def authorize(v): client_id = request.form.get("client_id") application = g.db.query(OauthApp).filter_by(client_id=client_id).first() @@ -113,7 +110,7 @@ def admin_app_approve(v, aid): g.db.add(new_auth) - send_notification(1046, v, f"Your application `{app.app_name}` has been approved. Here's your access token: `{access_token}`") + send_notification(1046, v, f"Your application `{app.app_name}` has been approved. Here's your access token: `{access_token}`\nPlease check the guide [here](/api) if you don't know what to do next.") return {"message": f"{app.app_name} approved"} diff --git a/drama/templates/settings_apps.html b/drama/templates/settings_apps.html index e427710c8..2921cb1fd 100644 --- a/drama/templates/settings_apps.html +++ b/drama/templates/settings_apps.html @@ -29,16 +29,6 @@ - - {% if app.client_secret %} - - - - Click to show - - {% endif %} - - @@ -72,16 +62,6 @@ - - {% if app.client_secret %} - - - - Click to show - - {% endif %} - -