Skip to content

Bugfix/18569 failed to impersonate with token#18571

Merged
brandonkelly merged 4 commits into4.xfrom
bugfix/18569-failed-to-impersonate-with-token
Mar 17, 2026
Merged

Bugfix/18569 failed to impersonate with token#18571
brandonkelly merged 4 commits into4.xfrom
bugfix/18569-failed-to-impersonate-with-token

Conversation

@i-just
Copy link
Copy Markdown
Contributor

@i-just i-just commented Mar 17, 2026

Description

Prevents an exception from being thrown when an anonymous user tries to impersonate another user via a token. An error logged in such a case will read “Unknown user tried to impersonate userId: XYZ but something went wrong.”

Leaving return null in such a case in v4 would still result in a redirect to the homepage or the CP login page, but in v5, an empty page would be shown, so I opted to ensure the redirection happens in both v4 and v5.

A flash message won’t be shown unless you log into the control panel with your credentials straight after failed impersonation.

Related issues

#18569

@i-just i-just requested a review from brandonkelly March 17, 2026 11:20
@brandonkelly brandonkelly merged commit 76c3846 into 4.x Mar 17, 2026
2 checks passed
@brandonkelly brandonkelly deleted the bugfix/18569-failed-to-impersonate-with-token branch March 17, 2026 15:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants