From 694e8a2a264c15ff95db66b8cf86ca84aa23ba88 Mon Sep 17 00:00:00 2001 From: Cédric Bonhomme Date: Wed, 4 Apr 2018 23:38:24 +0200 Subject: account checking without storing the email of the user --- src/notifications/notifications.py | 20 +++----------------- 1 file changed, 3 insertions(+), 17 deletions(-) (limited to 'src/notifications/notifications.py') diff --git a/src/notifications/notifications.py b/src/notifications/notifications.py index 2f8fc0b8..29cb6ef1 100644 --- a/src/notifications/notifications.py +++ b/src/notifications/notifications.py @@ -26,25 +26,11 @@ from notifications import emails from web.lib.user_utils import generate_confirmation_token -def information_message(subject, plaintext): - """ - Send an information message to the users of the platform. - """ - 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.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, - bcc=", ".join(user_emails[i:i+19]), - subject=subject, plaintext=plaintext) - -def new_account_notification(user): +def new_account_notification(user, email): """ Account creation notification. """ - token = generate_confirmation_token(user.email) + token = generate_confirmation_token(user.nickname) expire_time = datetime.datetime.now() + \ datetime.timedelta(seconds=conf.TOKEN_VALIDITY_PERIOD) @@ -53,7 +39,7 @@ def new_account_notification(user): token=token, expire_time=expire_time) - emails.send(to=user.email, bcc=conf.NOTIFICATION_EMAIL, + emails.send(to=email, bcc=conf.NOTIFICATION_EMAIL, subject="[Newspipe] Account creation", plaintext=plaintext) def new_password_notification(user, password): -- cgit