summaryrefslogtreecommitdiffstats
path: root/python/fatcat_web/auth.py
diff options
context:
space:
mode:
authorbnewbold <bnewbold@archive.org>2021-02-26 22:33:52 +0000
committerbnewbold <bnewbold@archive.org>2021-02-26 22:33:52 +0000
commitdf79a3dd9ffae5fcb8f32ea331c49ae4e9d998ed (patch)
tree1b4c4b589a43a36c0a11b578d6f4f96c3129213a /python/fatcat_web/auth.py
parent67ee012ccc63ffcd98964ab58b2bcc49c5b6693a (diff)
parenta5e9309c148019539127f41d7fefd722d0ae3bf2 (diff)
downloadfatcat-df79a3dd9ffae5fcb8f32ea331c49ae4e9d998ed.tar.gz
fatcat-df79a3dd9ffae5fcb8f32ea331c49ae4e9d998ed.zip
Merge branch 'bnewbold-202102-tweaks' into 'master'
Feb 2021 web UI/UX tweaks See merge request webgroup/fatcat!96
Diffstat (limited to 'python/fatcat_web/auth.py')
-rw-r--r--python/fatcat_web/auth.py19
1 files changed, 10 insertions, 9 deletions
diff --git a/python/fatcat_web/auth.py b/python/fatcat_web/auth.py
index ed9f2252..74b8e2d6 100644
--- a/python/fatcat_web/auth.py
+++ b/python/fatcat_web/auth.py
@@ -40,7 +40,11 @@ def handle_token_login(token):
session['api_token'] = token
session['editor'] = editor.to_dict()
login_user(load_user(editor.editor_id))
- return redirect("/auth/account")
+ rp = "/auth/account"
+ if session.get('next'):
+ rp = session['next']
+ session.pop('next')
+ return redirect(rp)
# This will need to login/signup via fatcatd API, then set token in session
def handle_oauth(remote, token, user_info):
@@ -71,13 +75,6 @@ def handle_oauth(remote, token, user_info):
editor = resp.editor
api_token = resp.token
- if http_status == 201:
- flash("Welcome to Fatcat! An account has been created for you with a temporary username; you may wish to change it under account settings")
- flash("You must use the same mechanism ({}) to login in the future".format(remote.name))
- flash("Check out 'The Guide' (linked above) for an editing quickstart tutorial")
- else:
- flash("Welcome back {}!".format(editor.username))
-
# write token and username to session
session.permanent = True
session['api_token'] = api_token
@@ -85,7 +82,11 @@ def handle_oauth(remote, token, user_info):
# call login_user(load_user(editor_id))
login_user(load_user(editor.editor_id))
- return redirect("/auth/account")
+ rp = "/auth/account"
+ if session.get('next'):
+ rp = session['next']
+ session.pop('next')
+ return redirect(rp)
# XXX: what should this actually be?
raise Exception("didn't receive OAuth user_info")