diff options
author | Andrea Lepori <alepori@student.ethz.ch> | 2022-01-05 14:48:32 +0100 |
---|---|---|
committer | Andrea Lepori <alepori@student.ethz.ch> | 2022-01-05 14:48:44 +0100 |
commit | 27751495e1adda17ca1e0ee4882b7fccf74dc612 (patch) | |
tree | af994fc5bc0da2e2cf5611799c7c5115c777d5a5 | |
parent | check oauth when creating/editing documents (diff) | |
download | scout-subs-27751495e1adda17ca1e0ee4882b7fccf74dc612.tar.gz scout-subs-27751495e1adda17ca1e0ee4882b7fccf74dc612.zip |
move all views together in accounts
-rw-r--r-- | accounts/views.py | 26 | ||||
-rw-r--r-- | version.txt | 2 |
2 files changed, 15 insertions, 13 deletions
diff --git a/accounts/views.py b/accounts/views.py index 4c5f006..fabd5a4 100644 --- a/accounts/views.py +++ b/accounts/views.py @@ -46,18 +46,6 @@ def get_oauth_data(token): return requests.get(api_url, headers=headers) -# send to hitobito request to get token -def oauth_login(request): - redirect_uri = request.build_absolute_uri(reverse('auth')) - - # forward next page requested by user - if not request.GET["next"]: - redirect_uri += "?next=/" - else: - redirect_uri += "?next=" + request.GET["next"] - - return hitobito.authorize_redirect(request, redirect_uri) - def copy_from_midata(request, usercode): resp = get_oauth_data(usercode.midata_token) @@ -80,6 +68,20 @@ def copy_from_midata(request, usercode): return True +### Views ### + +# send to hitobito request to get token +def oauth_login(request): + redirect_uri = request.build_absolute_uri(reverse('auth')) + + # forward next page requested by user + if not request.GET["next"]: + redirect_uri += "?next=/" + else: + redirect_uri += "?next=" + request.GET["next"] + + return hitobito.authorize_redirect(request, redirect_uri) + # callback after acquiring token def auth(request): token = hitobito.authorize_access_token(request) diff --git a/version.txt b/version.txt index bab59e6..bf22b4c 100644 --- a/version.txt +++ b/version.txt @@ -1,2 +1,2 @@ version=0.4
-rev=16 +rev=17 |