aboutsummaryrefslogtreecommitdiff
path: root/src/web/notifications.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/notifications.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/notifications.py')
-rw-r--r--src/web/notifications.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/web/notifications.py b/src/web/notifications.py
index c0d4fb1c..309da2a3 100644
--- a/src/web/notifications.py
+++ b/src/web/notifications.py
@@ -21,6 +21,7 @@
import conf
from web import emails
+from web.lib.user_utils import generate_confirmation_token
def information_message(subject, plaintext):
@@ -30,7 +31,7 @@ def information_message(subject, plaintext):
from web.models import User
users = User.query.all()
# Only send email for activated accounts.
- user_emails = [user.email for user in users if user.activation_key == ""]
+ user_emails = [user.email for user in users if user.enabled]
# Postmark has a limit of twenty recipients per message in total.
for i in xrange(0, len(user_emails), 19):
emails.send(to=conf.NOTIFICATION_EMAIL,
@@ -41,8 +42,9 @@ def new_account_notification(user):
"""
Account creation notification.
"""
+ token = generate_confirmation_token(user.email)
plaintext = """Hello,\n\nYour account has been created. Click on the following link to confirm it:\n%s\n\nSee you,""" % \
- (conf.PLATFORM_URL + 'user/confirm_account/' + user.activation_key)
+ (conf.PLATFORM_URL + 'user/confirm_account/' + token)
emails.send(to=user.email, bcc=conf.NOTIFICATION_EMAIL,
subject="[jarr] Account creation", plaintext=plaintext)
bgstack15