aboutsummaryrefslogtreecommitdiff
path: root/src/web/views/user.py
diff options
context:
space:
mode:
authorCédric Bonhomme <cedric@cedricbonhomme.org>2016-02-18 08:59:13 +0100
committerCédric Bonhomme <cedric@cedricbonhomme.org>2016-02-18 08:59:13 +0100
commit2e5a241777ef0bb0d76420d39bf3be41e16e042a (patch)
tree3223b8fba4fa244fa97b0df0b8bf8c5b91aeffec /src/web/views/user.py
parentCheck if the id of the category is '0'. (diff)
downloadnewspipe-2e5a241777ef0bb0d76420d39bf3be41e16e042a.tar.gz
newspipe-2e5a241777ef0bb0d76420d39bf3be41e16e042a.tar.bz2
newspipe-2e5a241777ef0bb0d76420d39bf3be41e16e042a.zip
New management of the token for the account confirmation.
Diffstat (limited to 'src/web/views/user.py')
-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 754d3b9a..0f9fe612 100644
--- a/src/web/views/user.py
+++ b/src/web/views/user.py
@@ -7,6 +7,7 @@ from flask.ext.login import login_required
import conf
from web import utils, notifications
+from web.lib.user_utils import confirm_token
from web.controllers import (UserController, FeedController, ArticleController)
from web.forms import ProfileForm, RecoverPasswordForm
@@ -102,16 +103,17 @@ def delete_account():
return redirect(url_for('login'))
-@user_bp.route('/confirm_account/<string:activation_key>', methods=['GET'])
-def confirm_account(activation_key=None):
+@user_bp.route('/confirm_account/<string:token>', methods=['GET'])
+def confirm_account(token=None):
"""
Confirm the account of a user.
"""
user_contr = UserController()
- if activation_key != "":
- user = user_contr.read(activation_key=activation_key).first()
+ if token != "":
+ email = confirm_token(token, expiration=3600)
+ user = user_contr.read(email=email).first()
if user is not None:
- user_contr.update({'id': user.id}, {'activation_key': ''})
+ 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')
bgstack15