def change_password():
    """The view function allows the user to change their current password"""

    form, error = ChangePasswordForm(), None
    user = User(email=Session.lookup('email'))

    if form.validate_on_submit():

        if user.Account.Password.change_old_password(form):

            user.Account.Password.email_user_about_password_change()
            Session.delete_login_credentials()
            return redirect(
                url_for('password_app.password_successful_changed'))

    return render_template('password/new_password.html', form=form)
Beispiel #2
0
def logout():
    """Logs the user out of the application"""

    Session.delete_login_credentials()
    return redirect(url_for('login_app.login'))