Пример #1
0
def account_settings_update():
    user = User.query.get(session['user']['id'])
    form = SettingsForm(request.form)

    if form.validate():
        user.name = form.name.data
        if form.current_password.data != "" and form.new_password.data != "":
            if check_password_hash(user.password, form.current_password.data):
                user.password = generate_password_hash(form.new_password.data)
    
    db.session.commit()

    return redirect(url_for('account_settings_page'))
Пример #2
0
def account_settings_update():
    user = User.query.get(session["user"]["id"])
    form = SettingsForm(request.form)

    if form.validate():
        user.name = form.name.data
        if form.current_password.data != "" and form.new_password.data != "":
            if check_password_hash(user.password, form.current_password.data):
                user.password = generate_password_hash(form.new_password.data)
    else:
        return render_template("account_settings.html", user=user, form=form, user_privs=dump_user_privileges(user))

    db.session.commit()

    return redirect(url_for("account_settings_page"))
Пример #3
0
def account_settings_page():
    user = User.query.get(session['user']['id'])
    form = SettingsForm(name=user.name)

    return render_template("account_settings.html",
                           user=user,
                           form=form,
                           user_privs=dump_user_privileges(user))
Пример #4
0
def account_settings_update():
    user = User.query.get(session['user']['id'])
    form = SettingsForm(request.form)

    if form.validate():
        user.name = form.name.data
        if form.current_password.data != "" and form.new_password.data != "":
            if check_password_hash(user.password, form.current_password.data):
                user.password = generate_password_hash(form.new_password.data)
    else:
        return render_template("account_settings.html",
                               user=user,
                               form=form,
                               user_privs=dump_user_privileges(user))

    db.session.commit()

    return redirect(url_for('account_settings_page'))