Skip to content

stages/email: fix ungrammatical expiry time in password reset templates - #22758

Merged
BeryJu merged 9 commits into
goauthentik:mainfrom
lwillek:fix/password_reset_templates
Jul 13, 2026
Merged

BeryJu merged 9 commits into
goauthentik:mainfrom
lwillek:fix/password_reset_templates

Conversation

@lwillek

@lwillek lwillek commented May 29, 2026

Copy link
Copy Markdown
Contributor

Details

Django's naturaltime filter 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 naturaltime with timeuntil in the default password reset email templates. timeuntil returns 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.txt
  • authentik/stages/email/templates/email/password_reset.html

Related issues


This is my first contribution to authentik — please let me know if anything needs adjustment.

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
@lwillek
lwillek requested a review from a team as a code owner May 29, 2026 12:19
@netlify

netlify Bot commented May 29, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for authentik-docs ready!

Name Link
🔨 Latest commit c156b4b
🔍 Latest deploy log https://app.netlify.com/projects/authentik-docs/deploys/6a54d857d9a72300084c3c6e
😎 Deploy Preview https://deploy-preview-22758--authentik-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Signed-off-by: Jens Langhammer <[email protected]>
@BeryJu
BeryJu requested a review from a team as a code owner June 3, 2026 11:28
@BeryJu BeryJu changed the title stages/email: fix ungrammatical expiry time in password reset templates stages/email: fix ungrammatical expiry time in email templates Jun 3, 2026
@BeryJu BeryJu added the backport/version-2026.5 Add this label to PRs to backport changes to version-2026.5 label Jun 3, 2026
@netlify

netlify Bot commented Jun 3, 2026

Copy link
Copy Markdown

✅ Deploy Preview for authentik-integrations ready!

Name Link
🔨 Latest commit d069784
🔍 Latest deploy log https://app.netlify.com/projects/authentik-integrations/deploys/6a200ffa0cf4980008ea559c
😎 Deploy Preview https://deploy-preview-22758--authentik-integrations.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify

netlify Bot commented Jun 3, 2026

Copy link
Copy Markdown

✅ Deploy Preview for authentik-storybook ready!

Name Link
🔨 Latest commit d069784
🔍 Latest deploy log https://app.netlify.com/projects/authentik-storybook/deploys/6a200ffa11b7db000885659f
😎 Deploy Preview https://deploy-preview-22758--authentik-storybook.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify

netlify Bot commented Jun 3, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for authentik-integrations ready!

Name Link
🔨 Latest commit c156b4b
🔍 Latest deploy log https://app.netlify.com/projects/authentik-integrations/deploys/6a54d8572858be0008169103
😎 Deploy Preview https://deploy-preview-22758--authentik-integrations.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@codecov

codecov Bot commented Jun 3, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.22%. Comparing base (a14919c) to head (097ddc6).
⚠️ Report is 2 commits behind head on main.

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     
Flag Coverage Δ
conformance 36.20% <0.00%> (-0.01%) ⬇️
e2e 41.38% <0.00%> (-0.01%) ⬇️
integration 32.59% <0.00%> (-0.05%) ⬇️
rust 0.00% <ø> (ø)
unit 92.35% <100.00%> (+0.02%) ⬆️
unit-migrate 92.40% <100.00%> (+0.03%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

@netlify

netlify Bot commented Jun 4, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for authentik-storybook ready!

Name Link
🔨 Latest commit 097ddc6
🔍 Latest deploy log https://app.netlify.com/projects/authentik-storybook/deploys/6a54dfe2cd05980008f06aa4
😎 Deploy Preview https://deploy-preview-22758--authentik-storybook.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

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.
@lwillek lwillek changed the title stages/email: fix ungrammatical expiry time in email templates stages/email: fix ungrammatical expiry time in password reset templates Jun 4, 2026
@lwillek

lwillek commented Jun 4, 2026 •

Copy link
Copy Markdown
Contributor Author

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!

BeryJu added 2 commits July 13, 2026 13:21
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]>
@BeryJu
BeryJu merged commit bc65b25 into goauthentik:main Jul 13, 2026
115 checks passed
@authentik-cherry-pick

Copy link
Copy Markdown
Contributor

🍒 Cherry-pick to version-2026.5 created: #23952

BeryJu added a commit that referenced this pull request Jul 13, 2026
…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]>
kensternberg-authentik added a commit that referenced this pull request Jul 13, 2026
* 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)
  ...
kensternberg-authentik added a commit that referenced this pull request Jul 13, 2026
* 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)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport/version-2026.5 Add this label to PRs to backport changes to version-2026.5

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(email): password_reset templates use naturaltime filter causing ungrammatical output

4 participants