diff --git a/warehouse/email/__init__.py b/warehouse/email/__init__.py index 09201cf33e27..a0cb5f182b30 100644 --- a/warehouse/email/__init__.py +++ b/warehouse/email/__init__.py @@ -274,11 +274,11 @@ def send_password_reset_email(request, user_and_email): { "action": "password-reset", "user.id": str(user.id), - "user.last_login": str(user.last_login), + "user.last_login": str( + user.last_login or datetime.datetime.min.replace(tzinfo=pytz.UTC) + ), "user.password_date": str( - user.password_date - if user.password_date is not None - else datetime.datetime.min.replace(tzinfo=pytz.UTC) + user.password_date or datetime.datetime.min.replace(tzinfo=pytz.UTC) ), } )