Send email notifications when a token becomes expired.
Review Request #12591 — Created Sept. 12, 2022 and submitted
Currently, users do not get notified about expired tokens. With this change, an
email is sent the first time an expired token is used. The email describes when
the token expired and how to create new tokens. If the email was successfully
sent, any subsequent uses of the token do not trigger another email.This change also fixes up all of the API token email templates by adding date
formatting and fixing some missing URLs. The tests for the templates were also
fixed up.
- Created unit tests for the expired token emails and ran unit tests in
reviewboard/notifications/tests/test_email_sending.py
- Manually tested authenticating with expired and non expired tokens, confirmed
that appropriate emails were sent.
Summary | ID |
---|---|
c776280c3483ba6eb35f95e8ca56cc0b603e4f3b |
Description | From | Last Updated |
---|---|---|
'djblets.webapi.signals.webapi_token_deleted' imported but unused Column: 1 Error code: F401 |
reviewbot | |
continuation line under-indented for visual indent Column: 25 Error code: E128 |
reviewbot | |
continuation line under-indented for visual indent Column: 25 Error code: E128 |
reviewbot | |
I think this is meant to say "deleted"? |
chipx86 | |
You can leave off the , None, since that's the default. |
chipx86 | |
This would be better as a boolean, I think. |
chipx86 | |
Can you add some additional checks to verify the display of the timestamps in the content? I noticed none of … |
chipx86 | |
line too long (80 > 79 characters) Column: 80 Error code: E501 |
reviewbot | |
line too long (80 > 79 characters) Column: 80 Error code: E501 |
reviewbot | |
line too long (80 > 79 characters) Column: 80 Error code: E501 |
reviewbot | |
line too long (80 > 79 characters) Column: 80 Error code: E501 |
reviewbot |
- Summary:
-
[WIP] Send email notifications when a token becomes expired.Send email notifications when a token becomes expired.
- Description:
-
~ Send email notifications when a token becomes expired.
~ Currently, users do not get notified about expired tokens. With this change, an
+ email is sent the first time an expired token is used. The email describes when + the token expired and how to create new tokens. If the email was successfully + sent, any subsequent uses of the token do not trigger another email. - Testing Done:
-
+ - Created unit tests for the expired token emails and ran unit tests in
reviewboard/notifications/tests/test_email_sending.py
+ - Manually tested authenticating with expired and non expired tokens, confirmed
that appropriate emails were sent.
- Created unit tests for the expired token emails and ran unit tests in
- Commits:
-
Summary ID c00ad41587f6c99ff4b7ed3b22dbdd0962e5be59 9b8288b530a283b467b7763f4867576b4ca1e2a2 - Depends On:
-
- Diff:
Revision 2 (+296 -32)
Checks run (2 succeeded)
flake8 passed.JSHint passed.
- Change Summary:
-
Checks whether an expired notification has already been sent.
- Commits:
-
Summary ID 9b8288b530a283b467b7763f4867576b4ca1e2a2 02beaf6960bc85338a1c4ca41bcdce943b513a73 - Diff:
-
Revision 3 (+298 -32)
- Change Summary:
-
Fix under-indented lines.
- Commits:
-
Summary ID 02beaf6960bc85338a1c4ca41bcdce943b513a73 ac5d088ae9646d3b353cc14e2dfca19a8de5daae - Diff:
-
Revision 4 (+298 -32)
Checks run (2 succeeded)
-
-
-
-
-
Can you add some additional checks to verify the display of the timestamps in the content?
I noticed none of our API token e-mails force a timestamp format, but our other templates all do. Inconsistent, which.. fine, it's been that way a while, but for some future-proofing, it'll be good to make sure we have some testing around how it actually ends up rendering.
In fact, these templates are so small, let's compare the full strings (
assertHTMLEqual
for the HTML one).
- Change Summary:
-
- Changed
expired_notification_sent
to a boolean - Spruced up the API token email templates by adding date formatting and fixing some missing URLs.
- Spruced up the tests for the templates by checking the full strings of the text and html templates.
- Changed
- Description:
-
Currently, users do not get notified about expired tokens. With this change, an
email is sent the first time an expired token is used. The email describes when the token expired and how to create new tokens. If the email was successfully sent, any subsequent uses of the token do not trigger another email. + + This change also fixes up all of the API token email templates by adding date
+ formatting and fixing some missing URLs. The tests for the templates were also + fixed up. - Commits:
-
Summary ID ac5d088ae9646d3b353cc14e2dfca19a8de5daae c67837f6476fa1c1d5feda35fbedc82aaffd57d8 - Diff:
-
Revision 5 (+680 -142)
Checks run (1 failed, 1 succeeded)
flake8
- Change Summary:
-
Shortened some lines that were too long.
- Commits:
-
Summary ID c67837f6476fa1c1d5feda35fbedc82aaffd57d8 c776280c3483ba6eb35f95e8ca56cc0b603e4f3b - Diff:
-
Revision 6 (+688 -142)