views.py 文件源码

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

项目:myproject 作者: dengliangshi 项目源码 文件源码
def password_reset(token):
    """Reset password using token.
    """
    if not current_user.is_anonymous:
        return redirect(url_for('.index'))
    form = PasswordResetForm()
    if form.validate_on_submit():
        user = User.query.filter_by(email=form.email.data).first()
        if user is None:
            return redirect(url_for('.index'))
        if user.reset_password(token, form.password.data):
            flash('Your password has been updated.')
            return redirect(url_for('auth.login'))
        else:
            return redirect(url_for('.index'))
    return render_template('auth/reset_password.html', form=form)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号