cloudflare-next-intl 0.10.15 → 0.10.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -510,6 +510,7 @@ bundled — for apps that never set `firebaseAuth`.
|
|
|
510
510
|
|
|
511
511
|
Features include:
|
|
512
512
|
- `whiteListPaths`: Array of paths exempt from auth redirects (matches exact path or path-segment prefix, e.g. `/bonds` matches `/bonds/some-slug`).
|
|
513
|
+
- `protectedPaths`: `(path) => boolean` gate that inverts `whiteListPaths` — when set, every path passes through unless `protectedPaths` (or `isAuthPath`) returns true, so unrecognised URLs reach the app's own routing instead of being redirected to `redirectAuthPath`. Preferred over `whiteListPaths` for apps where most pages are public: both the middleware and `AuthUserProvider` (client) derive their whitelist from it directly, so you don't maintain two separate path lists that can drift out of sync. `whiteListPaths` is only consulted when `protectedPaths` isn't set.
|
|
513
514
|
- `actionLinkPath`: Pinned route for handling Firebase action links (e.g. `/auth/action`), prioritized during cross-origin action link redirects.
|
|
514
515
|
- `createForgotPasswordAction(locale, actionCodeSettings?)`: Accepts optional Firebase `AuthActionCodeSettings` (e.g. `url` redirect link).
|
|
515
516
|
- `sendVerificationEmail(actionCodeSettings?)` on `useAuthUser()`: Custom action email settings when resending email verification.
|
|
@@ -76,7 +76,9 @@ export default function AuthUserProvider({ initialUser = null, children }) {
|
|
|
76
76
|
const router = useRouter();
|
|
77
77
|
const pathname = usePathname();
|
|
78
78
|
const isAuthPage = fa.isAuthPath(pathname);
|
|
79
|
-
const isWhiteListed =
|
|
79
|
+
const isWhiteListed = fa.protectedPaths
|
|
80
|
+
? !fa.protectedPaths(pathname) && !isAuthPage
|
|
81
|
+
: isWhitelisted(pathname, fa.whiteListPaths);
|
|
80
82
|
const maxAge = fa.sessionCookieMaxAge ?? 60 * 60 * 24 * 5;
|
|
81
83
|
const sessionCookieName = fa.sessionCookieName ?? defaultSessionCookieName;
|
|
82
84
|
const refreshTokenMaxAge = fa.refreshTokenCookieMaxAge ?? 60 * 60 * 24 * 365;
|