shopware icon indicating copy to clipboard operation
shopware copied to clipboard

WIP Allow admin customer login

Open ugurkankya opened this issue 2 years ago • 7 comments

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.

Bildschirmfoto 2022-09-24 um 00 27 24

Bildschirmfoto 2022-09-28 um 00 03 02

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.

ugurkankya avatar Aug 21 '23 21:08 ugurkankya

Fails
:no_entry_sign: You should not use the same commit message multiple times

github-actions[bot] avatar Aug 21 '23 21:08 github-actions[bot]

I have opened a new pull request, since i have accidentally destroyed my changes so github was not showing changed files.

Old PR: https://github.com/shopware/platform/pull/2701

ugurkankya avatar Aug 21 '23 21:08 ugurkankya

Push fast 😆

PheysX avatar Aug 22 '23 11:08 PheysX

@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?

ugurkankya avatar Aug 25 '23 17:08 ugurkankya

I think i found the solution about admin auth in storefront by using _routeScope => 'api' it seems working :)

ugurkankya avatar Aug 25 '23 20:08 ugurkankya

Any news on this? :)

sobyte avatar May 13 '24 14:05 sobyte

@ugurkankya I hope that you don't mind that I've continued your work and opened #3713

sobyte avatar May 14 '24 10:05 sobyte

@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

ugurkankya avatar May 14 '24 19:05 ugurkankya

I will close this then in favour of the new PR

mitelg avatar May 15 '24 05:05 mitelg