コード例 #1
0
def reset_password(code):
    if not current_user.is_anonymous:
        flash('You must be logged out to reset your password', 'warning')
        return redirect(url_for("dashboard_home.index"))

    try:
        email = token.decode(code, salt=constants.PASSWORD_RESET_SALT)
    except Exception:
        email = None

    if not email:
        return abort(403)

    form = ChangePasswordForm()
    if form.validate_on_submit():
        user = User.query.filter_by(email=email).one()
        user.password = form.password.data
        db.session.commit()
        login_user(user)

        flash("Changed your password succesfully", "success")
        return redirect(
            request.args.get("next") or url_for("dashboard_home.index"))

    return render_template("auth/reset_password.html", form=form)
コード例 #2
0
def change_password():
    form = ChangePasswordForm()

    if form.validate_on_submit():
        current_user.set_password(form.password.data)
        db.session.commit()
        flash("Changed password", "success")
    else:
        form = ChangePasswordForm()
        return render_template('/settings/change_password.html', form=form)
コード例 #3
0
ファイル: dashboard.py プロジェクト: justdeserves/Ignite
def change_password():
    form = ChangePasswordForm()

    if form.validate_on_submit():
        current_user.password = form.password.data
        db.session.commit()
        flash("Changed password", "success")
    else:
        flash("The password was invalid", "warning")

    return redirect(url_for("dashboard_settings.index"))
コード例 #4
0
ファイル: dashboard.py プロジェクト: justdeserves/Ignite
def settings():
    # TODO: Implement @fresh_login_required for non-oauthed users (users with a password)
    form = ChangePasswordForm()
    return render_template('dashboard/settings.html', form=form)
コード例 #5
0
ファイル: dashboard.py プロジェクト: justdeserves/Ignite
def team():
    form = ChangePasswordForm()
    membership = current_membership()
    team = membership.team
    return render_template('dashboard/team.html', form=form, team=team)