Make /logout operate on POST only.
This commit is contained in:
parent
0ccfa74709
commit
f397140e20
4 changed files with 10 additions and 3 deletions
|
@ -83,11 +83,11 @@ def post_login():
|
||||||
session_manager.add(session)
|
session_manager.add(session)
|
||||||
return jsonify.make_json_response({})
|
return jsonify.make_json_response({})
|
||||||
|
|
||||||
@site.route('/logout', methods=['GET', 'POST'])
|
@site.route('/logout', methods=['POST'])
|
||||||
@session_manager.give_token
|
@session_manager.give_token
|
||||||
def logout():
|
def logout():
|
||||||
session_manager.remove(request)
|
session_manager.remove(request)
|
||||||
response = flask.Response('redirect', status=302, headers={'Location': common.back_url()})
|
response = jsonify.make_json_response({})
|
||||||
return response
|
return response
|
||||||
|
|
||||||
# User registration ################################################################################
|
# User registration ################################################################################
|
||||||
|
|
|
@ -37,6 +37,11 @@ pre
|
||||||
|
|
||||||
margin-bottom: 4px;
|
margin-bottom: 4px;
|
||||||
}
|
}
|
||||||
|
#header button
|
||||||
|
{
|
||||||
|
border: 0;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
.header_element
|
.header_element
|
||||||
{
|
{
|
||||||
display: flex;
|
display: flex;
|
||||||
|
@ -49,6 +54,7 @@ pre
|
||||||
{
|
{
|
||||||
background-color: #ffffd4;
|
background-color: #ffffd4;
|
||||||
}
|
}
|
||||||
|
|
||||||
.editor_input
|
.editor_input
|
||||||
{
|
{
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
<a class="header_element" href="/tags">Tags</a>
|
<a class="header_element" href="/tags">Tags</a>
|
||||||
{% if session.user %}
|
{% if session.user %}
|
||||||
<a class="header_element" href="/user/{{session.user.username}}">{{session.user.display_name}}</a>
|
<a class="header_element" href="/user/{{session.user.username}}">{{session.user.display_name}}</a>
|
||||||
<a class="header_element" href="/logout" style="flex:0">Logout</a>
|
<button class="header_element" onclick="common.post('/logout', null, common.refresh);" style="flex:0">Logout</button>
|
||||||
{% else %}
|
{% else %}
|
||||||
<a class="header_element" href="/login">Log in</a>
|
<a class="header_element" href="/login">Log in</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
||||||
<link rel="stylesheet" href="/static/css/common.css">
|
<link rel="stylesheet" href="/static/css/common.css">
|
||||||
|
<script src="/static/js/common.js"></script>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
#content_body
|
#content_body
|
||||||
|
|
Loading…
Reference in a new issue