Skip to content

Conversation

rilrom
Copy link
Contributor

@rilrom rilrom commented Aug 28, 2025

What?

When ?locale= is present in an admin panel URL and that admin panel URL is visited in an unauthenticated browser, a runtime error is thrown.

Why?

upsertPreferences relies on req.user to successfully create a new payload-preferences document. When an unauthenticated user visits a URL with a locale parameter, upsertPreferences is called but req.user is not available.

How?

Prevent upsertPreferences from being called when req.user is not available.

Fixes #13581

@PatrikKozak PatrikKozak self-requested a review October 2, 2025 19:16
@PatrikKozak PatrikKozak merged commit ece5a95 into payloadcms:main Oct 2, 2025
172 of 178 checks passed
Copy link
Contributor

github-actions bot commented Oct 7, 2025

🚀 This is included in version v3.59.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Login redirect fails when ?locale query parameter is present
2 participants