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
iv
flaskdav
Commits
1c872791
Commit
1c872791
authored
Dec 08, 2015
by
iv
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Redirect by default to flaskdav's main page (back_url is optional)
+ show accepted cookie list.
parent
6cc217e6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
2 deletions
+28
-2
flaskdav.py
flaskdav.py
+7
-1
templates/authorization_page.html
templates/authorization_page.html
+21
-1
No files found.
flaskdav.py
View file @
1c872791
...
...
@@ -323,6 +323,7 @@ def authorize():
if
request
.
method
==
'POST'
:
response
=
make_response
()
debug
(
request
.
form
.
items
())
if
request
.
form
.
get
(
'reset'
)
==
'true'
:
debug
(
'old key was: '
+
app
.
secret_key
)
generate_key
()
...
...
@@ -339,8 +340,9 @@ def authorize():
else
:
return
'Something went wrong...'
response
.
status
=
'301'
# moved permanently
response
.
headers
[
'Location'
]
=
'/'
if
back
:
response
.
status
=
'301'
# moved permanently
response
.
headers
[
'Location'
]
=
back
# what if not? use referer? send bad request error? just do nothing?
...
...
@@ -348,6 +350,10 @@ def authorize():
debug
(
request
.
args
)
headers
=
request
.
headers
response
=
make_response
(
render_template
(
'authorization_page.html'
,
cookie_list
=
[
base64_decode
(
cookey
)
for
cookey
in
request
.
cookies
.
keys
()
if
verify_cookie
(
cookey
)
],
origin
=
request
.
args
.
get
(
'origin'
),
back_url
=
request
.
args
.
get
(
'back_url'
)))
return
response
...
...
templates/authorization_page.html
View file @
1c872791
<div>
Allow origin: {{ origin }} ?
</div>
<div>
You will then be redirected to {{ back_url }} .
</div>
<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>
<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>
<form
action=
""
method=
"post"
>
<input
type=
"checkbox"
name=
"reset"
value=
"true"
>
Invalidate all previous cookies
<br>
<button
name=
"accept"
value=
"ok"
>
OK
</button>
...
...
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