Skip to content

Commit 2297060

Browse files
authored
Hypha should not send e-mails to none users unless they are signing up. (#4798)
1 parent 1645d0e commit 2297060

2 files changed

Lines changed: 1 addition & 28 deletions

File tree

hypha/apply/users/services.py

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -92,14 +92,6 @@ def _get_url_params(self) -> None | str:
9292

9393
return None
9494

95-
def send_email_no_account_found(self, to):
96-
subject = f"Log in attempt at {settings.ORG_LONG_NAME}"
97-
# Force subject to a single line to avoid header-injection issues.
98-
subject = "".join(subject.splitlines())
99-
100-
email = MarkdownMail("users/emails/passwordless_login_no_account_found.md")
101-
email.send(to=to, subject=subject, from_email=settings.DEFAULT_FROM_EMAIL)
102-
10395
def send_login_email(self, user):
10496
login_path = self._get_login_path(user)
10597
timeout_minutes = self.login_token_generator_class().TIMEOUT // 60
@@ -162,9 +154,8 @@ def initiate_login_signup(self, email: str) -> None:
162154
self.send_login_email(user)
163155
return
164156

165-
# No account found
157+
# No account found and no public signup, do nothing.
166158
if not settings.ENABLE_PUBLIC_SIGNUP:
167-
self.send_email_no_account_found(email)
168159
return
169160

170161
# Self registration is enabled
@@ -175,5 +166,3 @@ def initiate_login_signup(self, email: str) -> None:
175166
},
176167
)
177168
self.send_new_account_login_email(signup_obj)
178-
179-
return True

hypha/apply/users/templates/users/emails/passwordless_login_no_account_found.md

Lines changed: 0 additions & 16 deletions
This file was deleted.

0 commit comments

Comments
 (0)