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

Update login.service.js #1285

Closed
wants to merge 2 commits into from
Closed

Conversation

elmarputz
Copy link

Fixes login error with running administration watcher. If you use a different domain than "localhost" with your dev environment, the login will not work when you work in the backend with hot reload based on "bin/watch-administration.sh". This snippet is based on forum entry found here: https://forum.shopware.com/discussion/68312/admin-watch-login-geht-nicht-unter-version-6-2-0-rc1

1. Why is this change necessary?

2. What does this change do, exactly?

3. Describe each step to reproduce the issue or behaviour.

4. Please link to the relevant issues (if any).

5. Checklist

  • I have written tests and verified that they fail without my change
  • I have squashed any insignificant commits
  • I have written or adjusted the documentation according to my changes
  • This change has comments for package types, values, functions, and non-obvious lines of code
  • I have read the contribution requirements and fulfil them.

Fixes login error with running administration watcher. If you use a different domain than "localhost" with your dev environment, the login will not work when you work in the backend with hot reload based on "bin/watch-administration.sh". This snippet is based on forum entry found here: https://forum.shopware.com/discussion/68312/admin-watch-login-geht-nicht-unter-version-6-2-0-rc1
@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Copy link
Collaborator

@pweyck pweyck left a comment

Choose a reason for hiding this comment

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

Please fix the lint error about self

@@ -321,9 +321,9 @@ export default function createLoginService(httpClient, context, bearerAuth = nul
* @returns {CookieStorage}
*/
function cookieStorageFactory() {
const domain = context.host;
// take current domain instead of context to enable other hosts than "localhost"
const domain = window.location.hostname;
Copy link
Member

Choose a reason for hiding this comment

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

login.service.js?3aeb:324 Uncaught ReferenceError: window is not defined
at cookieStorageFactory (login.service.js?3aeb:324)
at createLoginService (login.service.js?3aeb:23)
at onMessage (admin-worker.worker.js?5b99:20)

It needs to work also without window object

Copy link
Author

Choose a reason for hiding this comment

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

Thanks for the feedback - its just a quick hack to demonstrate the problem. I don't know if its on purpose that the watcher process is restricted to "localhost" but at least for my development process, it needs to work with custom dev domains as well.

@brunogoossens
Copy link

fixed the problem for me. Now I'm able to use the watcher inside a vagrant box

@pweyck
Copy link
Collaborator

pweyck commented Oct 9, 2020

This PR was closed due to inactivity. If this change is still important to you, feel free to create a new pull request.
For more information about our contribution guidelines, see https://docs.shopware.com/en/shopware-platform-dev-en/contribution/contribution-guideline

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

Successfully merging this pull request may close these issues.

7 participants