Coverage for users/services.py: 53%

15 statements  

« prev     ^ index     » next       coverage.py v6.4.4, created at 2023-03-29 14:03 -0600

1from django.conf import settings 

2from sentry_sdk import capture_exception 

3from app.sendgrid import SendgridClient 

4 

5 

6def send_initial_register_password_email(user, url): 

7 try: 

8 sendgrid = SendgridClient( 

9 to=user.email, 

10 ) 

11 sendgrid.send_dynamic_email( 

12 template_id=settings.SENDGRID_INITIAL_RESET_PASSWORD_TEMPLATE, 

13 dynamic_template_data={ 

14 "name": user.name, 

15 "url": url, 

16 }, 

17 ) 

18 except Exception as e: 

19 capture_exception(e) 

20 

21 

22def send_password_reset_email(user, url): 

23 try: 

24 sendgrid = SendgridClient( 

25 to=user.email, 

26 ) 

27 sendgrid.send_dynamic_email( 

28 template_id=settings.SENDGRID_RESET_PASSWORD_TEMPLATE, 

29 dynamic_template_data={ 

30 "name": user.name, 

31 "url": url, 

32 }, 

33 ) 

34 except Exception as e: 

35 capture_exception(e)