From 37765c755a609f56506bd9323fd665e5184cfce2 Mon Sep 17 00:00:00 2001 From: Patrick Jentsch Date: Tue, 9 Jul 2019 13:40:33 +0200 Subject: [PATCH] Rename profile to account and enable password change. --- app/auth/views.py | 14 ++++++++------ .../auth/{profile.html.j2 => account.html.j2} | 3 ++- app/templates/base.html.j2 | 2 +- 3 files changed, 11 insertions(+), 8 deletions(-) rename app/templates/auth/{profile.html.j2 => account.html.j2} (88%) diff --git a/app/auth/views.py b/app/auth/views.py index b09c1f5d..48b861b6 100644 --- a/app/auth/views.py +++ b/app/auth/views.py @@ -125,9 +125,9 @@ def password_reset(token): title='Password Reset') -@auth.route('/profile', methods=['GET', 'POST']) +@auth.route('/account', methods=['GET', 'POST']) @login_required -def profile(): +def account(): form = ChangeProfileForm() if form.validate_on_submit(): flash('It is just a test, nothing changed.') @@ -138,8 +138,10 @@ def profile(): current_user.email = form.email.data current_user.confirmed = False db.session.add(current_user) + resend_confirmation() + if form.password.data: + current_user.password = form.password.data db.session.commit() - resend_confirmation() - return redirect(url_for('auth.profile')) - return render_template('auth/profile.html.j2', form=form, - title='Profile') + return redirect(url_for('auth.account')) + return render_template('auth/account.html.j2', form=form, + title='Account') diff --git a/app/templates/auth/profile.html.j2 b/app/templates/auth/account.html.j2 similarity index 88% rename from app/templates/auth/profile.html.j2 rename to app/templates/auth/account.html.j2 index 5d81a6c3..0b5c33b7 100644 --- a/app/templates/auth/profile.html.j2 +++ b/app/templates/auth/account.html.j2 @@ -4,13 +4,14 @@
- Change profile + Change account information
{{ form.hidden_tag() }}
email {{ form.email(type='email', placeholder=current_user.email) }} {{ form.email.label }} + When changing your e-mail adress you will have to reconfirm it. {% for error in form.email.errors %} {{ error }} {% endfor %} diff --git a/app/templates/base.html.j2 b/app/templates/base.html.j2 index d34c0e25..735fa99c 100644 --- a/app/templates/base.html.j2 +++ b/app/templates/base.html.j2 @@ -20,7 +20,7 @@