Commit 300d6182 authored by iv's avatar iv

Add style to authorization page, clarify it, invert checkbox use.

parent 8636f972
...@@ -178,6 +178,7 @@ class WebDAV(MethodView): ...@@ -178,6 +178,7 @@ class WebDAV(MethodView):
data = render_template('get_collection.html', link_list=app.fs_handler.get_children(URI_BEGINNING_PATH['webdav'] + pathname)) data = render_template('get_collection.html', link_list=app.fs_handler.get_children(URI_BEGINNING_PATH['webdav'] + pathname))
elif os.path.isfile(localpath): elif os.path.isfile(localpath):
try: try:
#print(localpath + ': ' + mimetypes.guess_type(localpath))
headers["Content-type"] = mimetypes.guess_type(localpath)[0] headers["Content-type"] = mimetypes.guess_type(localpath)[0]
data_resource = app.fs_handler.get_data(URI_BEGINNING_PATH['webdav'] + pathname) data_resource = app.fs_handler.get_data(URI_BEGINNING_PATH['webdav'] + pathname)
if len(data_resource) > BUFFER_SIZE: if len(data_resource) > BUFFER_SIZE:
...@@ -387,7 +388,7 @@ def authorize(): ...@@ -387,7 +388,7 @@ def authorize():
if request.method == 'POST': if request.method == 'POST':
response = make_response() response = make_response()
debug(request.form.items()) debug(request.form.items())
if request.form.get('reset') == 'true': if request.form.get('continue') != 'true':
debug('old key was: ' + app.secret_key) debug('old key was: ' + app.secret_key)
generate_key() generate_key()
debug('new key is: ' + app.secret_key) debug('new key is: ' + app.secret_key)
......
body {
font-family: 'Open Sans', Helvetica, Arial, sans-serif;
background: #BCC6CC;
}
.auth{
margin: auto;
padding: 2%;
width: 400px;
margin-top: 10%;
background: #FFFFFF;
border: solid;
border-radius: 20px;
border-color: #BCC6CC;
word-break: break-all;
}
h1, form {
text-align: center;
font-size: 100%;
}
p {
text-align: left;
}
.list {
font-size: small;
}
.hidden {
visibility: hidden;
}
\ No newline at end of file
<div>Allow origin: {{ origin }} ? </div> <html>
<head>
<link href="/static/style.css" rel="stylesheet" type="text/css">
</head>
<body>
<div class="auth">
<h1>Allow applications from {{ origin }} to access the WebDAV (by setting a cookie)? </h1>
<div>{% if back_url %} <p>{% if back_url %}
You will then be redirected to '{{ back_url }}'. You will then be redirected to '{{ back_url }}'.
{% else %} {% endif %}</p>
You will be redirected to the server's main page.
{% endif %}</div>
<div> <div class="list">
{% if cookie_list %} {% if cookie_list %}
List of cookies set for accepted origins until now: List of other authorized origins:
<ul> <ul>
{% for cookie in cookie_list %} {% for cookie in cookie_list %}
<li> {{ cookie }} </li> <li> {{ cookie }} </li>
{% endfor %} {% endfor %}
</ul> </ul>
{% else %} {% else %}
No cookies are set. No other origins are authorized to access the WebDAV server.
{% endif %} {% endif %}
</div> </div>
<form action="" method="post"> <form action="" method="post">
<input type="checkbox" name="reset" value="true"> Invalidate all previous cookies <br> <p class="cookie_reset {% if not cookie_list %}hidden{% endif %}"> <input type="checkbox" name="continue" value="true" checked> Continue allowing origins listed above </p>
<button name="accept" value="ok">OK</button> <button name="accept" value="ok">Allow this app!</button>
</form> </form>
</div>
</body>
</html>
\ No newline at end of file
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