WIP Allow admin customer login
1. Why is this change necessary?
Currently it is not possible to login as customer from administration
2. What does this change do, exactly?
Adds a new button "Login as customer" next to "Edit" after clicking the button a modal with sales channels list will be shown. Token will be generated to ensure not everyone can guess the token, the token will be validated on the storefront & store api side as well.


3. Describe each step to reproduce the issue or behaviour.
Administration -> Customers -> Overview select a customer after clicking on "Login as customer" you should see a modal "Select the sales channel below you wish to perform the login". Click on the sales channel you like and you should be redirected to the storefront like you would normal login. Cart and Context should be restored.
4. Please link to the relevant issues (if any).
https://github.com/shopware/platform/pull/1572 https://github.com/shopware/platform/issues/878
5. Checklist
- [ ] I have rebased my changes to remove merge conflicts
- [x] I have written tests and verified that they fail without my change
- [x] I have created a changelog file with all necessary information about my changes
- [x] I have written or adjusted the documentation according to my changes
- [x] This change has comments for package types, values, functions, and non-obvious lines of code
- [x] I have read the contribution requirements and fulfil them.
| Fails | |
|---|---|
| :no_entry_sign: | You should not use the same commit message multiple times |
I have opened a new pull request, since i have accidentally destroyed my changes so github was not showing changed files.
Push fast 😆
@keulinho
I do not see any security issue since i am validating the token in the storefront, so just guessing the customerId would not be enough.
If we move the logic to the admin-api how we can login the customer? I can not access the session from storefront in the admin api, even so it would still i think a bad practise.
@shyim What do you think about that situation?
I think i found the solution about admin auth in storefront by using _routeScope => 'api' it seems working :)
Any news on this? :)
@ugurkankya I hope that you don't mind that I've continued your work and opened #3713
@ugurkankya I hope that you don't mind that I've continued your work and opened #3713
Thank you for your help i really appreciate it
I will close this then in favour of the new PR