def post_new_password(): pw_form = PasswordForm() email_form = EmailForm() email_form.fill(current_user) deactivate_form = DeactivateForm() if pw_form.validate(): current_user.set_password(pw_form.new_password.data) current_user.update_with_cache() flash("Password successfully changed", "success") return render_template( "settings-account.html", pw_form=pw_form, email_form=email_form, deactivate_form=deactivate_form, )
def account_settings(): pw_form = PasswordForm() email_form = EmailForm() email_form.fill(current_user) deactivate_form = DeactivateForm() return render_template( "settings-account.html", pw_form=pw_form, email_form=email_form, deactivate_form=deactivate_form, active_tab="account", )
def post_change_email(): pw_form = PasswordForm() email_form = EmailForm() deactivate_form = DeactivateForm() if email_form.validate(): if email_form.email.data != current_user.email: current_user.change_email(email_form.email.data) flash("Email successfully changed", "success") if email_form.public.data != current_user.email_public: current_user.set("email_public", email_form.public.data) return render_template( "settings-account.html", pw_form=pw_form, email_form=email_form, deactivate_form=deactivate_form, )
def post_deactivate(): pw_form = PasswordForm() email_form = EmailForm() email_form.fill(current_user) deactivate_form = DeactivateForm() if deactivate_form.validate(current_user): for feed in current_user.subscribed_feeds(): current_user.unsubscribe(feed) User.destroy(current_user.id) current_user.logout() flash("You account was successfully deactivated", "success") redirect("/") return render_template( "settings-account.html", pw_form=pw_form, email_form=email_form, deactivate_form=deactivate_form, )