Skip to content

[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

Merged
merged 6 commits into from
Feb 15, 2024

Conversation

pandafy
Copy link
Member

@pandafy pandafy commented Feb 13, 2024

Closes #367

@coveralls
Copy link

coveralls commented Feb 13, 2024

Coverage Status

coverage: 97.858% (+0.01%) from 97.845%
when pulling fe93bcf on issues/367-improve-password-expiry-email
into 7e93b75 on master.

# Avoid overloading the SMTP server by sending multiple
# emails continuously.
email_counts += 1
if email_counts > 10:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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>
Copy link
Member

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.

@@ -49,17 +54,31 @@ def password_expiration_email():
)
.filter(query)
)
email_counts = 0
Copy link
Member

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

Copy link
Member Author

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.

https://github.com/openwisp/openwisp-users/pull/368/files#diff-d5fb80ec22799c0be99cef82ca1ecf3dc5eab95fe1ef834d5168511e2be254ecR455-R468

@nemesifier nemesifier merged commit 13e6a87 into master Feb 15, 2024
@nemesifier nemesifier deleted the issues/367-improve-password-expiry-email branch February 15, 2024 16:35
@nemesifier nemesifier changed the title [change] Improved password expiration warning email #367 [chores] Improved password expiration warning email #367 Feb 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[chores] Improvements to password expiration warning email
3 participants