aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/notifications/notifications.py20
-rw-r--r--src/web/views/session_mgmt.py3
2 files changed, 4 insertions, 19 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):
diff --git a/src/web/views/session_mgmt.py b/src/web/views/session_mgmt.py
index 4982c549..4026e558 100644
--- a/src/web/views/session_mgmt.py
+++ b/src/web/views/session_mgmt.py
@@ -95,12 +95,11 @@ def signup():
form = SignupForm()
if form.validate_on_submit():
user = UserController().create(nickname=form.nickname.data,
- email=form.email.data,
pwdhash=generate_password_hash(form.password.data))
# Send the confirmation email
try:
- notifications.new_account_notification(user)
+ notifications.new_account_notification(user, form.email.data)
except Exception as error:
flash(gettext('Problem while sending activation email: %(error)s',
error=error), 'danger')
bgstack15