aboutsummaryrefslogtreecommitdiffstats
path: root/python/fatcat_web/routes.py
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2019-04-09 17:17:31 -0700
committerBryan Newbold <bnewbold@robocracy.org>2019-04-09 17:17:31 -0700
commit0840e5211309cd9e80ad7b2bbe82df3971423323 (patch)
tree57dd49d91e2a0bea622ed4c5ebcaf7116d472e4d /python/fatcat_web/routes.py
parentebedda562b528db3f14e47093b380ef41a303261 (diff)
downloadfatcat-0840e5211309cd9e80ad7b2bbe82df3971423323.tar.gz
fatcat-0840e5211309cd9e80ad7b2bbe82df3971423323.zip
crude mostly-working wikipedia (mediawiki) login
Diffstat (limited to 'python/fatcat_web/routes.py')
-rw-r--r--python/fatcat_web/routes.py17
1 files changed, 15 insertions, 2 deletions
diff --git a/python/fatcat_web/routes.py b/python/fatcat_web/routes.py
index f6b08f54..f14ca5f6 100644
--- a/python/fatcat_web/routes.py
+++ b/python/fatcat_web/routes.py
@@ -9,8 +9,8 @@ from flask_wtf.csrf import CSRFError
from fatcat_client import Editgroup, EditgroupAnnotation
from fatcat_client.rest import ApiException
from fatcat_tools.transforms import *
-from fatcat_web import app, api, auth_api, priv_api
-from fatcat_web.auth import handle_token_login, handle_logout, load_user, handle_ia_xauth
+from fatcat_web import app, api, auth_api, priv_api, mwoauth
+from fatcat_web.auth import handle_token_login, handle_logout, load_user, handle_ia_xauth, handle_wmoauth
from fatcat_web.cors import crossdomain
from fatcat_web.search import *
from fatcat_web.hacks import strip_extlink_xml, wayback_suffix
@@ -673,6 +673,19 @@ def auth_account():
load_user(editor.editor_id)
return render_template('auth_account.html')
+@app.route('/auth/wikipedia/auth')
+def wp_oauth_rewrite():
+ """
+ This is a dirty hack to rewrite '/auth/wikipedia/auth' to '/auth/wikipedia/oauth-callback'
+ """
+ return redirect(b"/auth/wikipedia/oauth-callback?" + request.query_string, 307)
+
+@app.route('/auth/wikipedia/finish-login')
+def wp_oauth_finish_login():
+ wp_username = mwoauth.get_current_user(cached=True)
+ assert(wp_username)
+ return handle_wmoauth(wp_username)
+
### Static Routes ###########################################################