1
0
Fork 0

Merge pull request #2326 from bookwyrm-social/synchronous-confirmation-emails

Send confirmation emails directly, rather than with celery
This commit is contained in:
Mouse Reeve 2022-11-01 18:43:53 -07:00 committed by GitHub
commit 641fc325b4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 5 additions and 4 deletions

View file

@ -23,7 +23,7 @@ def email_confirmation_email(user):
data = email_data()
data["confirmation_code"] = user.confirmation_code
data["confirmation_link"] = user.confirmation_link
send_email.delay(user.email, *format_email("confirm", data))
send_email(user.email, *format_email("confirm", data))
def invite_email(invite_request):

View file

@ -20,6 +20,7 @@ from bookwyrm.tests.validate_html import validate_html
class RegisterViews(TestCase):
"""login and password management"""
# pylint: disable=invalid-name
def setUp(self):
"""we need basic test data and mocks"""
self.factory = RequestFactory()
@ -382,6 +383,6 @@ class RegisterViews(TestCase):
"""try again"""
request = self.factory.post("", {"email": "mouse@mouse.com"})
request.user = self.anonymous_user
with patch("bookwyrm.emailing.send_email.delay") as mock:
with patch("bookwyrm.emailing.send_email") as mock:
views.ResendConfirmEmail.as_view()(request)
self.assertEqual(mock.call_count, 1)

View file

@ -7,7 +7,7 @@ upstream web {
server {
listen 80;
location ~ ^/(login[^-]|password-reset|resend-link|2fa-check) {
location ~ ^/(login[^-/]|password-reset|resend-link|2fa-check) {
limit_req zone=loginlimit;
proxy_pass http://web;

View file

@ -41,7 +41,7 @@ server {
# root /var/www/certbot;
# }
#
# location ~ ^/(login[^-]|password-reset|resend-link|2fa-check) {
# location ~ ^/(login[^-/]|password-reset|resend-link|2fa-check) {
# limit_req zone=loginlimit;
#
# proxy_pass http://web;