diff --git a/app/profile/forms.py b/app/profile/forms.py index 756875a2..60257805 100644 --- a/app/profile/forms.py +++ b/app/profile/forms.py @@ -6,12 +6,12 @@ from wtforms.validators import DataRequired, Email, EqualTo class EditEmailForm(FlaskForm): email = StringField('New email', validators=[Email(), DataRequired()]) - save_email = SubmitField('Save Email') + save_email = SubmitField('Save email') class EditGeneralSettingsForm(FlaskForm): dark_mode = BooleanField('Dark mode') - save_settings = SubmitField('Save Settings') + save_settings = SubmitField('Save settings') class EditPasswordForm(FlaskForm): @@ -27,7 +27,7 @@ class EditPasswordForm(FlaskForm): validators=[DataRequired(), EqualTo('password', message='Passwords must match.')] ) - save_password = SubmitField('Save Password') + save_password = SubmitField('Save password') def __init__(self, user, *args, **kwargs): super(EditPasswordForm, self).__init__(*args, **kwargs) diff --git a/app/profile/views.py b/app/profile/views.py index 3033020f..013db5d9 100644 --- a/app/profile/views.py +++ b/app/profile/views.py @@ -1,4 +1,4 @@ -from app import db +from app import db, logger from flask import current_app, flash, redirect, render_template, url_for from flask_login import current_user, login_required, logout_user from threading import Thread @@ -12,13 +12,14 @@ from .forms import EditEmailForm, EditGeneralSettingsForm, EditPasswordForm def settings(): edit_email_form = EditEmailForm(prefix='edit-email-form') edit_general_settings_form = EditGeneralSettingsForm( - prefix='edit-settings-form' + prefix='edit-general-settings-form' ) edit_password_form = EditPasswordForm(prefix='edit-password-form', user=current_user) # Check if edit_email_form is submitted and valid if (edit_email_form.save_email.data and edit_email_form.validate_on_submit()): + logger.warning('edit_email_form submitted') db.session.add(current_user) db.session.commit() flash('Your email address has been updated.') @@ -26,6 +27,7 @@ def settings(): # Check if edit_settings_form is submitted and valid if (edit_general_settings_form.save_settings.data and edit_general_settings_form.validate_on_submit()): + logger.warning('edit_general_settings_form submitted') current_user.is_dark = edit_general_settings_form.dark_mode.data db.session.add(current_user) db.session.commit() @@ -34,12 +36,14 @@ def settings(): # Check if edit_password_form is submitted and valid if (edit_password_form.save_password.data and edit_password_form.validate_on_submit()): + logger.warning('edit_password_form submitted') current_user.password = edit_password_form.password.data db.session.add(current_user) db.session.commit() flash('Your password has been updated.') return redirect(url_for('profile.settings')) # If no form is submitted or valid, fill out fields with current values + logger.warning('nothing submitted') edit_email_form.email.data = current_user.email edit_general_settings_form.dark_mode.data = current_user.is_dark return render_template( diff --git a/app/templates/profile/settings.html.j2 b/app/templates/profile/settings.html.j2 index 13d5376b..ccef6774 100644 --- a/app/templates/profile/settings.html.j2 +++ b/app/templates/profile/settings.html.j2 @@ -129,7 +129,7 @@
@@ -142,8 +142,8 @@Do you really want to delete your account and all associated data? All associated jobs and job files will be permanently deleted!
{% endblock %}