diff options
-rw-r--r-- | uploader/authorisation.py | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/uploader/authorisation.py b/uploader/authorisation.py index 71b42fa..efd4dbd 100644 --- a/uploader/authorisation.py +++ b/uploader/authorisation.py @@ -17,12 +17,7 @@ def require_login(function): flash("You need to be logged in.", "alert-danger") return redirect("/") - def __with_token__(token): - resp = oauth2_client().get( - urljoin(authserver_uri(), "auth/user/")) - userdetails = resp.json() - if not userdetails.get("error"): - return function(*args, **kwargs) - return __clear_session__(token) - return session.user_token().either(__clear_session__, __with_token__) + return session.user_token().either( + __clear_session__, + lambda token: function(*args, **kwargs)) return __is_session_valid__ |