Commit fb94610c authored by iv's avatar iv

Add redirection page (useful for end user to accept self-made SSL certificate...

Add redirection page (useful for end user to accept self-made SSL certificate and go back to an app).
parent 300d6182
...@@ -30,6 +30,7 @@ def debug(content): ...@@ -30,6 +30,7 @@ def debug(content):
print(content) print(content)
URI_BEGINNING_PATH = { URI_BEGINNING_PATH = {
'redirection': '/redirect/',
'authorization': '/login/', 'authorization': '/login/',
'system': '/system/', 'system': '/system/',
'webdav': '/webdav/', 'webdav': '/webdav/',
...@@ -375,6 +376,19 @@ app.add_url_rule( ...@@ -375,6 +376,19 @@ app.add_url_rule(
) )
@app.route(URI_BEGINNING_PATH['redirection'], methods=['GET', 'POST'])
def redirect():
"""
redirect the end user to the page or site given
as query, for example: ?back_url=https://somewhere/to/go
"""
back = request.args.get('back_url')
if back:
return make_response('', 301, {'Location': back})
response.status = '301' # moved permanently
else:
return "Nowhere to redirect to."
@app.route(URI_BEGINNING_PATH['authorization'], methods=['GET', 'POST']) @app.route(URI_BEGINNING_PATH['authorization'], methods=['GET', 'POST'])
def authorize(): def authorize():
""" authorization page """ authorization page
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment