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'))
评论列表
文章目录