Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't store ux_live_component URLs in setTargetPath of the security component #1096

Merged
merged 1 commit into from
Sep 7, 2023

Conversation

gbere
Copy link
Contributor

@gbere gbere commented Sep 6, 2023

Solves issue #1095

Q A
Bug fix? yes
New feature? no
Tickets Fix #1095
License MIT

Prevent to redirect to ux_live_component URL after login

@@ -2154,6 +2154,7 @@ class RequestBuilder {
const fetchOptions = {};
fetchOptions.headers = {
Accept: 'application/vnd.live-component+html',
'X-Requested-With': 'XMLHttpRequest',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why the value XMLHttpRequest'?

Copy link
Contributor Author

@gbere gbere Sep 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why the value XMLHttpRequest'?

Set the request like a AJAX request. It's the only way I found so that it does not store it in the setTargetPath

Copy link
Collaborator

@WebMamba WebMamba Sep 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes but setTargetPath look only if the XMLHttpRequest is present but doesn't look at his value at all: https://github.com/symfony/symfony/blob/2bac801f8a4cba02e8ecc840fa7bf512034f860a/src/Symfony/Component/HttpFoundation/Request.php#L1714.
The X-Requested-With is not an official header and I can't find official documentation about it, but it look like you can set the value you want. So we can have something like:
'X-Requested-With': 'symfony-ux-live-component',
What do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer to keep the one that already exists. This way you don't need to modify any other component.

@gbere gbere changed the title Update live_controller.js Don't store ux_live_component URLs in setTargetPath of the security component Sep 6, 2023
@weaverryan
Copy link
Member

Thanks Gerard!

@weaverryan weaverryan merged commit 264417e into symfony:2.x Sep 7, 2023
10 checks passed
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.

Symfony security authenticator targetPath saves ux_live_component URL
3 participants