solidusio / solidus

🛒 Solidus, the open-source eCommerce framework for industry trailblazers.
https://solidus.io
Other
4.98k stars 1.29k forks source link

"Email has already been taken" after delete (or destroy ?) an user #4645

Open joyboy67 opened 1 year ago

joyboy67 commented 1 year ago

Discussed in https://github.com/solidusio/solidus/discussions/4643 Originally posted by joyboy67 September 26, 2022

Hello, when I delete/destroy an user without orders from admin panel (https://github.com/solidusio/solidus/discussions/4590) and try to register a new user with the same email I get the error "Email has already been taken" whereas the user no longer exists in Spree::User.all

Env Rails version: 7.0.4 solidus_auth_devise (2.5.4) solidus (3.2.2)

EDIT: I found with Spree::User.with_discarded that the users was just discarded, but the data should not be scramble with scramble_email_and_password ? (https://github.com/solidusio/solidus_auth_devise/blob/master/app/models/spree/user.rb)

one record of an user destroyed (discarded ?):

#<Spree::User id: 8, email: "test@mail.com", persistence_token: nil, perishable_token: nil, last_request_at: nil, login: "21ccfd03-3109-4527-845d-db7ac88846e7@example.net", ship_address_id: nil, bill_address_id: nil, created_at: "2022-09-24 07:44:29.861021000 +0000", updated_at: "2022-09-24 07:45:26.552550000 +0000", spree_api_key: nil, authentication_token: nil, deleted_at: "2022-09-24 07:45:26.000000000 +0000">

irb(main):006:0> a.login
=> "21ccfd03-3109-4527-845d-db7ac88846e7@example.net"
irb(main):007:0> a.email
=> "test@mail.com"
irb(main):008:0> a.password
=> nil
irb(main):009:0> a.password_confirmation
=> nil
waiting-for-dev commented 1 year ago

Probably the issue can be moved to the solidus_auth_devise repository, but I'll leave it here until further investigation.

joyboy67 commented 1 year ago

@waiting-for-dev Yes the issue has been created here because it was created from Discussions

senemsoy commented 1 year ago

We tried to recreate this issue but failed; we saw the discarded user email get scrambled.

Env: Rails version: 7.0.4 solidus_auth_devise (2.5.7) solidus (3.3.0.alpha)