(do=None)
return render_template(
        'settings.html',
        password_form=password_form,
        delete_form=delete_form
    )
Provides forms allowing a user to change various settings.
Provides forms allowing a user to change various settings.
Provides forms allowing a user to change various settings .
def settings(do=None):
    """
    Provides forms allowing a user to change various settings.
    """
    password_form = UserPasswordForm()
    delete_form = UserDeleteForm()

    if do == 'p' and password_form.validate_on_submit():
        # Change the users password.
        g.user.set_password(password_form.password.data)
        db.session.commit()
        return redirect(url_for('.settings'))
    elif do == 'd' and delete_form.validate_on_submit():
        # Delete this users account and all related data.
        # Clear the session.
        if '_u' in session:
            del session['_u']
        if '_ue' in session:
            del session['_ue']
        # Remove the user from the DB.
        g.user.projects.order_by(False).delete()
        db.session.delete(g.user)
        db.session.commit()

        return redirect(url_for('.login'))

    return render_template(
        'settings.html',
        password_form=password_form,
        delete_form=delete_form
    )
def settings ( do = None ) : password_form = UserPasswordForm ( ) delete_form = UserDeleteForm ( ) if do == 'p' and password_form . validate_on_submit ( ) : # Change the users password. g . user . set_password ( password_form . password . data ) db . session . commit ( ) return redirect ( url_for ( '.settings' ) ) elif do == 'd' and delete_form . validate_on_submit ( ) : # Delete this users account and all related data. # Clear the session. if '_u' in session : del session [ '_u' ] if '_ue' in session : del session [ '_ue' ] # Remove the user from the DB. g . user . projects . order_by ( False ) . delete ( ) db . session . delete ( g . user ) db . session . commit ( ) return redirect ( url_for ( '.login' ) ) return render_template ( 'settings.html' , password_form = password_form , delete_form = delete_form )