Skip to content
Snippets Groups Projects
Commit 60f1cb75 authored by Stephan Porada's avatar Stephan Porada :speech_balloon:
Browse files

Revert to view per formular in user settings

parent 799101d3
No related branches found
No related tags found
No related merge requests found
......@@ -28,17 +28,26 @@ def index():
@profile.route('/change_password', methods=['POST'])
@login_required
def profile_change_password():
edit_user_info_form = EditProfileForm(user=current_user)
change_password_form = ChangePasswordForm()
if not change_password_form.validate_on_submit():
abort(400)
if current_user.verify_password(change_password_form.old_password.data):
current_user.password = change_password_form.new_password.data
db.session.add(current_user)
db.session.commit()
flash('Your password has been updated.')
if change_password_form.validate_on_submit():
if current_user.verify_password(change_password_form.old_password.data):
current_user.password = change_password_form.new_password.data
db.session.add(current_user)
db.session.commit()
flash('Your password has been updated.')
return render_template('profile/index.html.j2',
change_password_form=change_password_form,
edit_user_info_form=edit_user_info_form,
edit_user_settings_form=EditUserSettingsForm(),
title='Profile')
else:
flash('Invalid password.')
return redirect(url_for('profile.index'))
return render_template('profile/index.html.j2',
change_password_form=change_password_form,
edit_user_info_form=edit_user_info_form,
edit_user_settings_form=EditUserSettingsForm(),
title='Profile')
@profile.route('/edit_user_info', methods=['POST'])
......@@ -75,6 +84,10 @@ def profile_edit_user_settings():
logger.warning('Form data: {}'.format(current_user.is_dark))
db.session.add(current_user)
db.session.commit()
if current_user.is_dark is True:
flash('Dark mode has been activated!')
else:
flash('Dark mode has been deactivated!')
return redirect(url_for('profile.index'))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment