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):
data = render_template('get_collection.html', link_list=app.fs_handler.get_children(URI_BEGINNING_PATH['webdav'] + pathname))
elif os.path.isfile(localpath):
try:
#print(localpath + ': ' + mimetypes.guess_type(localpath))
headers["Content-type"] = mimetypes.guess_type(localpath)[0]
data_resource = app.fs_handler.get_data(URI_BEGINNING_PATH['webdav'] + pathname)
if len(data_resource) > BUFFER_SIZE:
......@@ -387,7 +388,7 @@ def authorize():
if request.method == 'POST':
response = make_response()
debug(request.form.items())
if request.form.get('reset') == 'true':
if request.form.get('continue') != 'true':
debug('old key was: ' + app.secret_key)
generate_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 %}
You will then be redirected to '{{ back_url }}'.
{% else %}
You will be redirected to the server's main page.
{% endif %}</div>
<p>{% if back_url %}
You will then be redirected to '{{ back_url }}'.
{% endif %}</p>
<div>
{% if cookie_list %}
List of cookies set for accepted origins until now:
<ul>
{% for cookie in cookie_list %}
<li> {{ cookie }} </li>
{% endfor %}
</ul>
{% else %}
No cookies are set.
{% endif %}
</div>
<div class="list">
{% if cookie_list %}
List of other authorized origins:
<ul>
{% for cookie in cookie_list %}
<li> {{ cookie }} </li>
{% endfor %}
</ul>
{% else %}
No other origins are authorized to access the WebDAV server.
{% endif %}
</div>
<form action="" method="post">
<input type="checkbox" name="reset" value="true"> Invalidate all previous cookies <br>
<button name="accept" value="ok">OK</button>
</form>
<form action="" method="post">
<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">Allow this app!</button>
</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