Pass next URL to OAuth

This commit is contained in:
Edward Betts 2019-09-27 20:23:01 +01:00
parent 51c245d637
commit 37af9ad1c0
2 changed files with 7 additions and 1 deletions

6
app.py
View file

@ -115,6 +115,12 @@ def set_url_args(**new_args):
args = {k: v for k, v in args.items() if v is not None} args = {k: v for k, v in args.items() if v is not None}
return url_for(request.endpoint, **args) return url_for(request.endpoint, **args)
@app.template_global()
def current_url():
args = request.view_args.copy()
args.update(request.args)
return url_for(request.endpoint, **args)
@app.before_request @app.before_request
def init_profile(): def init_profile():
g.profiling = [] g.profiling = []

View file

@ -88,7 +88,7 @@
<div class="alert alert-info mt-4" role="alert"> <div class="alert alert-info mt-4" role="alert">
This tool must be connected with Wikidata to work. This tool must be connected with Wikidata to work.
</div> </div>
<p><a href="{{ url_for('start_oauth') }}" class="btn btn-primary btn-lg">Connect with Wikidata</a> <p><a href="{{ url_for('start_oauth', next=current_url()) }}" class="btn btn-primary btn-lg">Connect with Wikidata</a>
{% endif %} {% endif %}
{% if username %} {% if username %}