-
-
Notifications
You must be signed in to change notification settings - Fork 81
[chores] Improved password expiration warning email #367 #368
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
openwisp_users/tasks.py
Outdated
# Avoid overloading the SMTP server by sending multiple | ||
# emails continuously. | ||
email_counts += 1 | ||
if email_counts > 10: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if email_counts > 10: | |
if email_counts >= 10: |
I think the current version of the code adds the sleep every 11 emails, not every 10.
@@ -0,0 +1,5 @@ | |||
{% load i18n %} | |||
|
|||
<p>{% blocktrans with expiry_date=expiry_date|date:"Y-m-d" %}We inform you that the password for your account {{ username }} will expire in 7 days, precisely on {{ expiry_date }}.{% endblocktrans %}<p> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use a date format which is human friendly.
openwisp_users/tasks.py
Outdated
@@ -49,17 +54,31 @@ def password_expiration_email(): | |||
) | |||
.filter(query) | |||
) | |||
email_counts = 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if we want to sleep at the 10th email we have to set this to 1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test here creates only 10 users, and the sleep is triggered after sending 10 emails.
Closes #367