Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
F
flaskdav
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
flaskdav
Commits
300d6182
Commit
300d6182
authored
Feb 01, 2016
by
iv
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add style to authorization page, clarify it, invert checkbox use.
parent
8636f972
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
64 additions
and
23 deletions
+64
-23
flaskdav.py
flaskdav.py
+2
-1
static/style.css
static/style.css
+33
-0
templates/authorization_page.html
templates/authorization_page.html
+29
-22
No files found.
flaskdav.py
View file @
300d6182
...
@@ -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
)
...
...
static/style.css
0 → 100644
View file @
300d6182
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
templates/authorization_page.html
View file @
300d6182
<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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment