Skip to content
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

added feature to send email once the user is blocked based on username #242

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

saurav-codes
Copy link

Implementation Details

The implementation checks for a new setting, DEFENDER_EMAIL_USER_ON_ACCOUNT_LOCKED, to determine if an email should be sent when an account is locked. by default it's False.

An email template defender/lockout_email.html is provided, which can be overridden by setting DEFENDER_LOCKOUT_EMAIL_TEMPLATE_PATH in the project's settings. The email is sent using Django's built-in send_mail function, assuming that the email backend configured for the project.

Copy link

codecov bot commented Feb 26, 2024

Codecov Report

Attention: Patch coverage is 52.94118% with 8 lines in your changes are missing coverage. Please review.

Project coverage is 91.03%. Comparing base (cc35032) to head (f39e27f).

Files Patch % Lines
defender/utils.py 42.85% 8 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #242      +/-   ##
==========================================
- Coverage   92.58%   91.03%   -1.55%     
==========================================
  Files          13       13              
  Lines         418      435      +17     
==========================================
+ Hits          387      396       +9     
- Misses         31       39       +8     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@kencochrane
Copy link
Collaborator

@saurav-codes it looks like some of the tests failed, it might require a change to the tox settings. maybe something changed recently.

@kencochrane
Copy link
Collaborator

@saurav-codes The change looks reasonable; if you can get the tests to pass and update the documentation, it should be good to merge. Thanks

@dkr-sahar
Copy link
Contributor

Just out of curiosity, wouldn’t it be slightly better to implement this based on django signals ? This would allow to plug-in other notification sources than email.

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.

None yet

3 participants