csrftoken

merge-requests/1/head
王宇洋 3 years ago
parent 66b7b02623
commit fe847c79b8

File diff suppressed because it is too large Load Diff

@ -7,25 +7,15 @@
{% block head %}
{{ super() }}
<style>
body {
padding-top: 60px;
background-color: #f5f5f5;
}
</style>
{{ super() }}
<style>
body {
padding-top: 60px;
background-color: #f5f5f5;
}
</style>
<meta name="csrf-token" content="{{ csrf_token() }}">
{# <script src="//cdnjs.cloudflare.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>#}
{# <script>#}
{#var csrftoken = $('meta[name=csrf-token]').attr('content');#}
{#$.ajaxSetup({#}
{# beforeSend: function(xhr, settings) {#}
{# if (!/^(GET|HEAD|OPTIONS|TRACE)$/i.test(settings.type) && !this.crossDomain) {#}
{# xhr.setRequestHeader('X-CSRFToken', csrftoken)#}
{# }#}
{# }#}
{#})#}
{# </script>#}
<script type="application/javascript" src="{{ url_for('static',filename='js/jquery-3.6.0.js') }}"></script>
{% endblock %}
@ -58,22 +48,27 @@
<ul class="nav navbar-nav navbar-right">
{% if current_user.is_authenticated %}
{# 通知#}
{# 通知#}
<li>
<a href="{{ url_for('main.notification') }}" >
<a href="{{ url_for('main.notification') }}">
<svg viewBox="0 0 1024 1024" width="20" height="20">
<defs><style type="text/css"></style></defs>
<path d="M892.343 738.743c7.314 0 21.943 0 29.257 7.314-29.257-21.943-51.2-58.514-51.2-95.086V424.23c0-168.229-117.029-307.2-285.257-343.772v-7.314C585.143 36.57 548.57 0 512 0s-80.457 36.571-80.457 73.143v7.314C270.629 117.03 153.6 256 153.6 424.23V650.97c0 36.572-21.943 73.143-51.2 95.086 7.314-7.314 14.629-7.314 29.257-7.314-29.257 0-51.2 21.943-51.2 51.2s21.943 51.2 51.2 51.2h768c29.257 0 51.2-21.943 51.2-51.2-7.314-21.943-29.257-43.886-58.514-51.2zM512 1024c73.143 0 131.657-58.514 131.657-131.657H380.343C380.343 965.486 438.857 1024 512 1024z" fill="#3BA9F6" p-id="1699">
<defs>
<style type="text/css"></style>
</defs>
<path d="M892.343 738.743c7.314 0 21.943 0 29.257 7.314-29.257-21.943-51.2-58.514-51.2-95.086V424.23c0-168.229-117.029-307.2-285.257-343.772v-7.314C585.143 36.57 548.57 0 512 0s-80.457 36.571-80.457 73.143v7.314C270.629 117.03 153.6 256 153.6 424.23V650.97c0 36.572-21.943 73.143-51.2 95.086 7.314-7.314 14.629-7.314 29.257-7.314-29.257 0-51.2 21.943-51.2 51.2s21.943 51.2 51.2 51.2h768c29.257 0 51.2-21.943 51.2-51.2-7.314-21.943-29.257-43.886-58.514-51.2zM512 1024c73.143 0 131.657-58.514 131.657-131.657H380.343C380.343 965.486 438.857 1024 512 1024z"
fill="#3BA9F6" p-id="1699">
</path>
</svg>
<span class="badge" style="margin-bottom: 10px"></span>
</a>
</li>
{# 下拉菜单#}
{# 下拉菜单#}
<li class="dropdown">
<a href="{{ url_for('main.notification') }}" class="dropdown-toggle" data-toggle="dropdown">Account<b class="caret"></b></a>
<a href="{{ url_for('main.notification') }}" class="dropdown-toggle"
data-toggle="dropdown">Account<b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="{{ url_for('main.user', username=current_user.username) }}">MY Profile</a></li>
<li><a href="{{ url_for('main.user', username=current_user.username) }}">MY
Profile</a></li>
<li><a href="{{ url_for('auth.change_password') }}">MY Account</a></li>
<li><a href="{{ url_for('auth.logout') }}">Log Out</a></li>
</ul>
@ -83,33 +78,43 @@
<li><a href="{{ url_for('auth.login') }}">Log In</a></li>
{% endif %}
</ul>
</div>
</ul>
</div>
</nav>
</div>
</nav>
{% endblock %}
{% block content %}
<div class="container">
<!-- flash消息显示区-->
{% for message in get_flashed_messages() %}
<div class="alert alert-warning">
<button type="button" class="close" data-dismiss="alert">&times;</button>
{{ message }}
</div>
{% endfor %}
{% for message in get_flashed_messages() %}
<div class="alert alert-warning">
<button type="button" class="close" data-dismiss="alert">&times;</button>
{{ message }}
</div>
{% endfor %}
{% block page_content %}
<!-- 其他模版文件中的东西-->
<!-- 其他模版文件中的东西-->
{% endblock %}
</div>
{% endblock %}
{% block scripts %}
{{ super() }}
{{ moment.include_moment() }}
{% endblock %}
{% block scripts %}
<script>
var csrftoken = $("head > meta:nth-child(5)").attr('content');
$.ajaxSetup({
beforeSend: function (xhr, settings) {
if (!/^(GET|HEAD|OPTIONS|TRACE)$/i.test(settings.type) && !this.crossDomain) {
xhr.setRequestHeader('X-CSRFToken', csrftoken)
}
}
})
</script>
{{ super() }}
{{ moment.include_moment() }}
{% endblock %}

Binary file not shown.
Loading…
Cancel
Save