Steps to reproduce:
1. Enable anonymous checkout
2. On the checkout form, enter a username that already exists and submit the form
3. Validation fails due to the existing username, but the username is stored with the order and committed to the database anyway
4. Clear the username field and submit the form
5. Continue with checkout to completion.
6. New user account creation fails because it was trying to use the stored username

Expected results:
Clearing the username field should clear the username stored with the order.

Other notes:
The same behavior occurs with the password field.

Proposed solution:
This is a little tricky, because the order is saved during validation and seems to only add/update data. So the attached patch always stores the entered username and password even if they're blank. This required a small change later on in the process to make sure these blank values are ignored.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

longwave’s picture

Version: 6.x-2.11 » 6.x-2.x-dev
Status: Active » Needs review
longwave’s picture

This is quite a subtle bug, thanks for tracking this down! The attached patch implements your steps to reproduce as a test case for now. I think there might be a cleaner way of resetting the username but having the test will prove that any change here works correctly.

Status: Needs review » Needs work

The last submitted patch, 1985404-new-username-error-reset-TEST-ONLY.patch, failed testing.

longwave’s picture

Status: Needs work » Needs review
FileSize
1.81 KB

This is much simpler than the patch proposed in #0 but still seems to work.

Status: Needs review » Needs work

The last submitted patch, 1985404-new-username-error-reset.patch, failed testing.

longwave’s picture

Status: Needs work » Needs review
FileSize
3.05 KB

It helps if I upload the right patch.

longwave’s picture

Version: 6.x-2.x-dev » 7.x-3.x-dev
Status: Needs review » Patch (to be ported)

As the test now passes, committed #6. Needs porting to 7.x-3.x.

longwave’s picture

Status: Patch (to be ported) » Needs review
FileSize
3.07 KB
longwave’s picture

Status: Needs review » Fixed

Committed to 7.x-3.x.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.