aboutsummaryrefslogtreecommitdiff
path: root/src/web
diff options
context:
space:
mode:
Diffstat (limited to 'src/web')
-rw-r--r--src/web/views/user.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/web/views/user.py b/src/web/views/user.py
index 0f9fe612..57153003 100644
--- a/src/web/views/user.py
+++ b/src/web/views/user.py
@@ -109,14 +109,16 @@ def confirm_account(token=None):
Confirm the account of a user.
"""
user_contr = UserController()
+ user, email = None, None
if token != "":
email = confirm_token(token, expiration=3600)
+ if email:
user = user_contr.read(email=email).first()
- if user is not None:
- user_contr.update({'id': user.id}, {'enabled': True})
- flash(gettext('Your account has been confirmed.'), 'success')
- else:
- flash(gettext('Impossible to confirm this account.'), 'danger')
+ if user is not None:
+ user_contr.update({'id': user.id}, {'enabled': True})
+ flash(gettext('Your account has been confirmed.'), 'success')
+ else:
+ flash(gettext('Impossible to confirm this account.'), 'danger')
return redirect(url_for('login'))
bgstack15