[PR #6288] [CLOSED] Feat/haveibeenpwned/support async custom message #6571

Closed
opened 2026-03-13 13:03:42 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/6288
Author: @Ridhim-RR
Created: 11/25/2025
Status: Closed

Base: canaryHead: feat/haveibeenpwned/support-async-custom-message


📝 Commits (10+)

📊 Changes

2 files changed (+29 additions, -7 deletions)

View changed files

📝 docs/content/docs/plugins/have-i-been-pwned.mdx (+2 -1)
📝 packages/better-auth/src/plugins/haveibeenpwned/index.ts (+27 -6)

📄 Description

Closes #6247

This PR adds support of using an async customPasswordCompromisedMessage in the haveIBeenPwned plugin.

Previously, users could only provide a static string:

 haveIBeenPwned({
    customPasswordCompromisedMessage: "Please choose a more secure password."
    });
Now, users can also provide an async function, enabling dynamic or localized messages
    haveIBeenPwned({
    customPasswordCompromisedMessage: "Please choose a more secure password."
     // Or provide an async function for dynamic or localized messages
  customPasswordCompromisedMessage: async () => {
    const locale = await getLocale();
    const t = await getMessages({ locale });
    return t("Your password has been compromised. Please choose a new password.");
  }
})

File Changes:

  • Updated logic in index.ts of haveIBeenPwned plugin.
  • Updated documentation in haveIBeenPwned mdx .

Summary by cubic

Adds async support for haveIBeenPwned’s customPasswordCompromisedMessage for dynamic/localized messages, with safe fallback to the default message.

  • New Features
    • haveIBeenPwned: customPasswordCompromisedMessage now accepts a string or async function, with fallback to the default message on errors. Docs updated.

Written for commit 42c236955e. Summary will update on new commits.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/better-auth/better-auth/pull/6288 **Author:** [@Ridhim-RR](https://github.com/Ridhim-RR) **Created:** 11/25/2025 **Status:** ❌ Closed **Base:** `canary` ← **Head:** `feat/haveibeenpwned/support-async-custom-message` --- ### 📝 Commits (10+) - [`6afd4dd`](https://github.com/better-auth/better-auth/commit/6afd4dd77a71a3b27262a5193b256b9167ceac11) fix(Passkey):delete-challenge - [`034f757`](https://github.com/better-auth/better-auth/commit/034f757adc245f05e20f1e79eaf72c596f5191b1) fix: test case - [`b5b22f3`](https://github.com/better-auth/better-auth/commit/b5b22f3e464161df51286113bf16d5ee92782eb0) Merge branch 'canary' into fix/passkey/delete-challenge - [`4a50afa`](https://github.com/better-auth/better-auth/commit/4a50afa365e1900b6429c814856eb6ccaa4d361e) chore: lint issue - [`93187d7`](https://github.com/better-auth/better-auth/commit/93187d726e1950789e5aacaa48777a2fc2578b78) Merge branch 'canary' of https://github.com/Ridhim-RR/better-auth into fix/passkey/delete-challenge - [`642db75`](https://github.com/better-auth/better-auth/commit/642db75b743607ced6b2c995d1f836ee348db5a3) Merge branch 'fix/passkey/delete-challenge' of https://github.com/Ridhim-RR/better-auth into fix/passkey/delete-challenge - [`5c82651`](https://github.com/better-auth/better-auth/commit/5c826511d6ad7d4c0bbdc5c2b2edb15a5e6f911d) Merge branch 'canary' of https://github.com/Ridhim-RR/better-auth into feat/haveibeenpwned/support-async-custom-message - [`f6e5626`](https://github.com/better-auth/better-auth/commit/f6e5626fc0096b5a85e435aaa142047f34a57baa) feat(haveIBeenPwned):support async custom message - [`e8488a2`](https://github.com/better-auth/better-auth/commit/e8488a2f8b7257b6d32e72d09f7c0e7c0b2b7b08) chore: linitng issue resolved - [`b1c7ae6`](https://github.com/better-auth/better-auth/commit/b1c7ae6516ed4642a06fee00b4a469910f69fe4d) Update docs/content/docs/plugins/have-i-been-pwned.mdx ### 📊 Changes **2 files changed** (+29 additions, -7 deletions) <details> <summary>View changed files</summary> 📝 `docs/content/docs/plugins/have-i-been-pwned.mdx` (+2 -1) 📝 `packages/better-auth/src/plugins/haveibeenpwned/index.ts` (+27 -6) </details> ### 📄 Description **Closes #6247** This PR adds support of using an **async** customPasswordCompromisedMessage in the haveIBeenPwned plugin. Previously, users could only provide a **static string**: ``` haveIBeenPwned({ customPasswordCompromisedMessage: "Please choose a more secure password." }); ``` Now, users can also provide an async function, enabling dynamic or localized messages ``` haveIBeenPwned({ customPasswordCompromisedMessage: "Please choose a more secure password." // Or provide an async function for dynamic or localized messages customPasswordCompromisedMessage: async () => { const locale = await getLocale(); const t = await getMessages({ locale }); return t("Your password has been compromised. Please choose a new password."); } }) ``` **File Changes:** - Updated logic in index.ts of haveIBeenPwned plugin. - Updated documentation in haveIBeenPwned mdx . <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Adds async support for haveIBeenPwned’s customPasswordCompromisedMessage for dynamic/localized messages, with safe fallback to the default message. - **New Features** - haveIBeenPwned: customPasswordCompromisedMessage now accepts a string or async function, with fallback to the default message on errors. Docs updated. <sup>Written for commit 42c236955e7dbc9039510b5500c625a1f06da209. Summary will update on new commits.</sup> <!-- End of auto-generated description by cubic. --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-03-13 13:03:42 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#6571