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

It is not possible to change a customers **login** email address #1071

Closed
ghost opened this issue Sep 6, 2021 · 0 comments
Closed

It is not possible to change a customers **login** email address #1071

ghost opened this issue Sep 6, 2021 · 0 comments
Assignees
Labels
type: bug 🐛 Something isn't working

Comments

@ghost
Copy link

ghost commented Sep 6, 2021

Describe the bug
It is currently not possible to change a customers email address, for the purpose of allowing the customer to login with the new email address. There are two tables - 'customers' & 'users' and only 'customers' ever changes - so in essence changing the login email address is not possible at this time.

When an admin changes a customers email address from the admin customer page -> The customer table is updated but the Users table is not updated. I verified this in the code also, the code only tries to update the Customer table.

If the customer than tries to login with the new email - it does not work.
If I update manually in the database, Users table, the email field to the new email address ( to match the customer table), the user is now able to login.

To Reproduce
Steps to reproduce the behavior:

  1. Login as admin - https://demo.vendure.io/
  2. Create user with email [email protected] with password 123456789
  3. Try to login to store front > success
  4. Go back to admin, update email to something else, example [email protected]
  5. Try to login with new email > Fail. However if you try to login with the old password > success.

This is because the update of the customer only affects the email address in the customers table, not the linked user. Which means that users cannot change their email addresses.

In my server, I did try to change the users table email address manually, after changing in UI the customers table email address, it seems to work with no noticeable side-effects.

The issue is, I am having a hard time creating this new mutation to have the save() method on customer update, to have it also update the user table. I am still learning TypeORM and can't get it to work.
I am certain this affects other users of Vendure, please help :)

Expected behavior
When an admin changes a customer's email address from the admin, the customer should be able to login with the new email address. However, the old email address is still being using by the AUTH - this is because there are two distinct tables that keep track of the users email address - the 'customers' and 'users' tables, however only the 'customers' table changes upon "update".

Environment (please complete the following information):

  • @vendure/core version: ^1.0.0-beta.8
  • Nodejs version: v14
  • Database (mysql/postgres etc): mysql

Additional context
The update logic is found here -
packages\admin-ui\src\lib\customer\src\components\customer-detail\customer-detail.component.ts
In this method -
save()
Therefore I want to update this method by adding code to also update the Users table, to update the user email address there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug 🐛 Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant