views.py 文件源码

python
阅读 19 收藏 0 点赞 0 评论 0

项目:TypingSystem 作者: TrustMe5 项目源码 文件源码
def modifypwd(username):                                             #????????
    if username!=session.get('name'):             #?????????????????????
        return redirect('/auth')
    else:
        form=ChangePersonalPwd()
        user=User.query.filter_by(name=username).first()
        if form.validate_on_submit():
           if user is not None and check_password_hash(user.password,form.oldpassword.data):
               if form.newpassword.data!=form.confirmpassword.data:
                  flash('??????????')
               else:
                  user.password=generate_password_hash(form.newpassword.data)
                  db.session.commit()
                  flash('?????')
                  return redirect('/auth')
           else:
               flash('??????????????')
    return render_template('modifypwd.html',form=form,writer=session.get('name'))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号