In the Account Information pane validation, whitespaces are not stripped out. This would give an "invalid email address" error when whitespace exists in the email value. When double entry of email address is required, email values where one has whitespaces at the end would also invalidate.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

akosipax created an issue. See original summary.

akosipax’s picture

Status: Active » Needs review
FileSize
1.52 KB

Here's a patch.

Status: Needs review » Needs work

The last submitted patch, 2: commerce_order-email_value_whitespaces-2560443-1.patch, failed testing.

rszrama’s picture

Title: Email addresses are not trimmed. Validation fails when whitespace exists. » Trim whitespace on the account checkout pane's e-mail address field
Version: 7.x-1.10 » 7.x-1.x-dev
Category: Bug report » Task

Can we not do this via an element validate handler w/ form_set_value()?

akosipax’s picture

Status: Needs work » Needs review
FileSize
1.3 KB

Is this preferable?

Status: Needs review » Needs work

The last submitted patch, 5: commerce_order-email_value_whitespaces-2560443-5.patch, failed testing.

akosipax’s picture

Status: Needs work » Needs review
FileSize
1.32 KB

Oops. I didn't pass an array to #element_validate.

Status: Needs review » Needs work

The last submitted patch, 7: commerce_order-email_value_whitespaces-2560443-7.patch, failed testing.

akosipax’s picture

Status: Needs work » Needs review
FileSize
1.58 KB

A, sorry. Trying this again.

MrPeanut’s picture

Patch from #9 applies cleanly and works on my site. Thanks!

joelpittet’s picture

Assigned: akosipax » Unassigned
Status: Needs review » Reviewed & tested by the community

Good call on trimming this, no need to have bad data from simple mistakes.

rszrama’s picture

Status: Reviewed & tested by the community » Needs work

Honestly, even for "private" functions prefixed w/ an underscore, we should include the module name in the prefix. The validate handler should be renamed _commerce_order_validate_order_mail(), and there's no reason to make $trimmed_email a separate variable really.

joelpittet’s picture

Status: Needs work » Needs review
FileSize
1.56 KB

Addressing feedback from #12

rszrama’s picture

Status: Needs review » Fixed

Awesome, thanks! I was thinking about it and actually went ahead and dropped the underscore prefix on the off chance other modules create interfaces for order e-mail addresses to be entered and want to reuse the validate handler.

  • rszrama committed 33d606a on 7.x-1.x authored by akosipax
    Issue #2560443 by akosipax, joelpittet, rszrama: Trim whitespace on the...

Status: Fixed » Closed (fixed)

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