Repository navigation
stages/email: fix ungrammatical expiry time in password reset templates - #22758
Conversation
Django's naturaltime filter outputs a prepositional phrase like "in 23 hours". When interpolated into the existing sentence "The above link is valid for ...", the prepositions clash, producing broken grammar in English and all localized languages. Replace naturaltime with timeuntil in both the HTML and plain-text password reset templates so the interpolated value is a bare duration string. Fixes goauthentik#22757
✅ Deploy Preview for authentik-docs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Signed-off-by: Jens Langhammer <[email protected]>
✅ Deploy Preview for authentik-integrations ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for authentik-storybook ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for authentik-integrations ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #22758 +/- ##
==========================================
- Coverage 93.25% 93.22% -0.03%
==========================================
Files 1044 1045 +1
Lines 61191 61207 +16
Branches 424 424
==========================================
- Hits 57063 57061 -2
- Misses 4128 4146 +18
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. |
✅ Deploy Preview for authentik-storybook ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
This reverts commit d069784. The original fix replaces naturaltime with timeuntil in the password reset templates, where the value is interpolated into the sentence "The above link is valid for ...". However, the reverted commit also changed the invitation templates, where the phrasing is different: "This invitation expires {{ expires }}." In this context, naturaltime is correct and timeuntil would produce awkward output. The fix only applies to the password reset templates; the invitation templates should remain unchanged.
|
Thanks @BeryJu for your review, contribution to this PR and approval! However, I think that the "invite" email template does not need a fix, as there the phrasing is different, so there naturaltime is correct and timeuntil would produce awkward output. The fix only applies to the password reset templates I think the invitation templates should remain unchanged - as they are fine already. Hence I reverted d069784 in 991faf6 - I hope this is OK. Looking forward for a new review! |
Signed-off-by: Jens Langhammer <[email protected]>
Signed-off-by: Jens Langhammer <[email protected]> # Conflicts: # website/docs/add-secure-apps/flows-stages/stages/email/index.md
Signed-off-by: Jens Langhammer <[email protected]>
|
🍒 Cherry-pick to |
…es (cherry-pick #22758 to version-2026.5) (#23952) stages/email: fix ungrammatical expiry time in password reset templates (#22758) * stages/email: fix ungrammatical expiry time in password reset templates Django's naturaltime filter outputs a prepositional phrase like "in 23 hours". When interpolated into the existing sentence "The above link is valid for ...", the prepositions clash, producing broken grammar in English and all localized languages. Replace naturaltime with timeuntil in both the HTML and plain-text password reset templates so the interpolated value is a bare duration string. Fixes #22757 * fix other templates too * Revert "fix other templates too" This reverts commit d069784. The original fix replaces naturaltime with timeuntil in the password reset templates, where the value is interpolated into the sentence "The above link is valid for ...". However, the reverted commit also changed the invitation templates, where the phrasing is different: "This invitation expires {{ expires }}." In this context, naturaltime is correct and timeuntil would produce awkward output. The fix only applies to the password reset templates; the invitation templates should remain unchanged. * fix template template * fixup --------- Signed-off-by: Jens Langhammer <[email protected]> Co-authored-by: Lutz Willek <[email protected]> Co-authored-by: Jens Langhammer <[email protected]> Co-authored-by: Connor Peshek <[email protected]>
* main: (30 commits) providers/saml: catch InvalidVersion from cryptography when parsing metadata (#21185) stages/user_login: refuse to log in an unsaved pending user (#21691) web/admin: hide previous loglist when no previous logs available (#23954) stages/email: fix ungrammatical expiry time in password reset templates (#22758) tests/openid_conformance: Add more conformance coverage (#22174) sources/ldap: derive TLS SNI name from hostname, not full server URI (#22456) core: bump github.com/grafana/pyroscope-go from 1.3.1 to 1.4.0 (#23885) web: Fix Log Viewer Intersection Observer. (#23861) web: bump the goauthentik group across 1 directory with 2 updates (#23926) ci: bump regclient/actions/regctl-login from 4b4db1dcc7dad75ad67a788a380f75a20cc8a040 to 39bf30ced4be9d147faaabbde2682e9725fb8bd1 (#23890) ci: bump regclient/actions/regctl-installer from 4b4db1dcc7dad75ad67a788a380f75a20cc8a040 to 39bf30ced4be9d147faaabbde2682e9725fb8bd1 (#23891) core: bump pnpm/pnpm from 11.10.0 to 11.11.0 in /website (#23930) core: bump pnpm/pnpm from 11.10.0 to 11.11.0 in /lifecycle/container (#23927) core: bump github.com/sethvargo/go-envconfig from 1.3.0 to 1.3.1 (#23921) core: bump goauthentik/selenium from 149.0-ak-0.50.1 to 149.0-ak-0.50.2 in /tests/e2e (#23924) core: bump uvicorn[standard] from 0.49.0 to 0.50.0 (#23925) core: bump ruff from 0.15.20 to 0.15.21 (#23928) core: bump goauthentik/fips-python from `aaaab46` to `0798f3b` in /lifecycle/container (#23929) ci: bump actions/stale from 10.3.0 to 10.4.0 (#23935) ci: bump github/codeql-action/autobuild from 4.36.3 to 4.37.0 (#23931) ...
* main: (48 commits) web/bug: harmonize and make routine the display of tasks (part 2: description list abuse) (#23839) providers/oauth2: fix iframe logout stage progression (#23919) providers/scim: improve error display when error doesn't conform to scim schema (#23955) providers/saml: catch InvalidVersion from cryptography when parsing metadata (#21185) stages/user_login: refuse to log in an unsaved pending user (#21691) web/admin: hide previous loglist when no previous logs available (#23954) stages/email: fix ungrammatical expiry time in password reset templates (#22758) tests/openid_conformance: Add more conformance coverage (#22174) sources/ldap: derive TLS SNI name from hostname, not full server URI (#22456) core: bump github.com/grafana/pyroscope-go from 1.3.1 to 1.4.0 (#23885) web: Fix Log Viewer Intersection Observer. (#23861) web: bump the goauthentik group across 1 directory with 2 updates (#23926) ci: bump regclient/actions/regctl-login from 4b4db1dcc7dad75ad67a788a380f75a20cc8a040 to 39bf30ced4be9d147faaabbde2682e9725fb8bd1 (#23890) ci: bump regclient/actions/regctl-installer from 4b4db1dcc7dad75ad67a788a380f75a20cc8a040 to 39bf30ced4be9d147faaabbde2682e9725fb8bd1 (#23891) core: bump pnpm/pnpm from 11.10.0 to 11.11.0 in /website (#23930) core: bump pnpm/pnpm from 11.10.0 to 11.11.0 in /lifecycle/container (#23927) core: bump github.com/sethvargo/go-envconfig from 1.3.0 to 1.3.1 (#23921) core: bump goauthentik/selenium from 149.0-ak-0.50.1 to 149.0-ak-0.50.2 in /tests/e2e (#23924) core: bump uvicorn[standard] from 0.49.0 to 0.50.0 (#23925) core: bump ruff from 0.15.20 to 0.15.21 (#23928) ...
Details
Django's
naturaltimefilter outputs a prepositional phrase (e.g., "in 23 hours"). When embedded in the existing sentence "The above link is valid for {{ expires }}", the prepositions clash, producing ungrammatical output in English ("valid for in 23 hours") as well as in translations (e.g., German: "gültig für in 23 Stunden").This PR replaces
naturaltimewithtimeuntilin the default password reset email templates.timeuntilreturns a bare duration string (e.g., "23 hours"), which fits correctly into the existing sentence structure across all locales.Changes
authentik/stages/email/templates/email/password_reset.txtauthentik/stages/email/templates/email/password_reset.htmlRelated issues
This is my first contribution to authentik — please let me know if anything needs adjustment.