diff options
author | Cédric Bonhomme <cedric@cedricbonhomme.org> | 2016-02-18 19:00:38 +0100 |
---|---|---|
committer | Cédric Bonhomme <cedric@cedricbonhomme.org> | 2016-02-18 19:00:38 +0100 |
commit | 4283bc19bff76b74d859230cd0ca54ab8f70a73e (patch) | |
tree | c789e2f3e8be79ecbe113eb565076172dbccb672 | |
parent | Typo. (diff) | |
download | newspipe-4283bc19bff76b74d859230cd0ca54ab8f70a73e.tar.gz newspipe-4283bc19bff76b74d859230cd0ca54ab8f70a73e.tar.bz2 newspipe-4283bc19bff76b74d859230cd0ca54ab8f70a73e.zip |
Improved confirm_account view.
-rw-r--r-- | src/web/views/user.py | 12 |
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')) |