aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCédric Bonhomme <cedric@cedricbonhomme.org>2016-02-18 19:00:38 +0100
committerCédric Bonhomme <cedric@cedricbonhomme.org>2016-02-18 19:00:38 +0100
commit4283bc19bff76b74d859230cd0ca54ab8f70a73e (patch)
treec789e2f3e8be79ecbe113eb565076172dbccb672 /src
parentTypo. (diff)
downloadnewspipe-4283bc19bff76b74d859230cd0ca54ab8f70a73e.tar.gz
newspipe-4283bc19bff76b74d859230cd0ca54ab8f70a73e.tar.bz2
newspipe-4283bc19bff76b74d859230cd0ca54ab8f70a73e.zip
Improved confirm_account view.
Diffstat (limited to 'src')
-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