mirror of
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
synced 2025-01-18 14:00:33 +00:00
Revert to view per formular in user settings
This commit is contained in:
parent
799101d380
commit
60f1cb7573
@ -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'))
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user