diff options
author | Cédric Bonhomme <cedric@cedricbonhomme.org> | 2018-04-04 23:38:24 +0200 |
---|---|---|
committer | Cédric Bonhomme <cedric@cedricbonhomme.org> | 2018-04-04 23:38:24 +0200 |
commit | 694e8a2a264c15ff95db66b8cf86ca84aa23ba88 (patch) | |
tree | b78e7d7cf47a16ad7d3221c5d546c47ffea84451 /src/notifications | |
parent | added migration script (diff) | |
download | newspipe-694e8a2a264c15ff95db66b8cf86ca84aa23ba88.tar.gz newspipe-694e8a2a264c15ff95db66b8cf86ca84aa23ba88.tar.bz2 newspipe-694e8a2a264c15ff95db66b8cf86ca84aa23ba88.zip |
account checking without storing the email of the user
Diffstat (limited to 'src/notifications')
-rw-r--r-- | src/notifications/notifications.py | 20 |
1 files changed, 3 insertions, 17 deletions
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): |