solidus icon indicating copy to clipboard operation
solidus copied to clipboard

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

Open joyboy67 opened this issue 3 years ago • 3 comments

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: "[email protected]", persistence_token: nil, perishable_token: nil, last_request_at: nil, login: "[email protected]", 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
=> "[email protected]"
irb(main):007:0> a.email
=> "[email protected]"
irb(main):008:0> a.password
=> nil
irb(main):009:0> a.password_confirmation
=> nil

joyboy67 avatar Sep 27 '22 08:09 joyboy67

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

waiting-for-dev avatar Sep 27 '22 12:09 waiting-for-dev

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

joyboy67 avatar Sep 27 '22 13:09 joyboy67

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)

senemsoy avatar Jan 19 '23 19:01 senemsoy