BBS论坛(四)
2025年01月14日 02:16:50

LIKE.TG | 发现全球营销软件&服务汇聚顶尖互联网营销和AI营销产品,提供一站式出海营销解决方案。唯一官网:www.like.tg
4.1.cms登录页面csrf保护
(1)Perfect_bbs.py
from flask_wtf import CSRFProtect
CSRFProtect(app)
添加csrf保护后,现在再去登录
(2)cms/cms_login.html添加csrf保护
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
4.2.cms后台修改密码界面布局完成
(1)cms.views.py
class ResetPwdView(views.MethodView):
decorators = [login_required]
def get(self):
return render_template('cms/cms_resetpwd.html')
def post(self):
pass
bp.add_url_rule('/resetpwd/',view_func=ResetPwdView.as_view('resetpwd'))
(2)cms/cms_base.html
<li><a href="{{ url_for('cms.resetpwd') }}">修改密码</a></li>
(3)cms/cms_resetpwd.html
{% extends 'cms/cms_base.html' %}
{% block title %}
修改密码
{% endblock %}
{% block page_title %}
{{ self.title() }}
{% endblock %}
{% block head %}
<style>
.form-container{
width: 300px;
}
</style>
{% endblock %}
{% block main_content %}
<form method="post">
<div class="form-container">
<div class="form-group">
<div class="input-group">
<span class="input-group-addon">旧密码</span>
<input type="password" class="form-control" name="oldpwd" placeholder="请输入旧密码">
</div>
</div>
<div class="form-group">
<div class="input-group">
<span class="input-group-addon">新密码</span>
<input type="password" class="form-control" name="newpwd" placeholder="请输入新密码">
</div>
</div>
<div class="form-group">
<div class="input-group">
<span class="input-group-addon">确认新密码</span>
<input type="password" class="form-control" name="newpwd2" placeholder="请确认新密码">
</div>
</div>
<div class="form-group">
<button class="btn btn-primary">立即保存</button>
</div>
</div>
</form>
{% endblock %}
效果:

LIKE.TG:汇集全球营销软件&服务,助力出海企业营销增长。提供最新的“私域营销获客”“跨境电商”“全球客服”“金融支持”“web3”等一手资讯新闻。
点击【联系客服】 🎁 免费领 1G 住宅代理IP/proxy, 即刻体验 WhatsApp、LINE、Telegram、Twitter、ZALO、Instagram、signal等获客系统,社媒账号购买 & 粉丝引流自助服务或关注【LIKE.TG出海指南频道】、【LIKE.TG生态链-全球资源互联社区】连接全球出海营销资源。
本文由LIKE.TG编辑部转载自互联网并编辑,如有侵权影响,请联系官方客服,将为您妥善处理。
This article is republished from public internet and edited by the LIKE.TG editorial department. If there is any infringement, please contact our official customer service for proper handling.
Server deployment全球论坛人工智能论坛全球峰会发展论坛战略论坛开放论坛程序员论坛互联网峰会科技峰会