Closed (fixed)
Project:
Commerce Core
Version:
7.x-1.x-dev
Component:
Customer
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
7 Aug 2011 at 18:28 UTC
Updated:
2 Mar 2012 at 22:30 UTC
Jump to comment: Most recent
Comments
Comment #1
rszrama commentedHmm, I'm not sure it's the @. I don't have any problems with it. Can e-mail addresses contain other non-standard characters?
Comment #2
artatac commentedSorry - I did not explain myself. The username is created from the email address say fred@something.com, But Drupal does not allow a username of fred@something.com. Try yourself going to admin/people/create and adding a user with a name like fred@something.com
Comment #3
artatac commentedor go to http://comfile04.venturacottage.com/content/splash-theme (as an anon user) and use example payment to buy it.
and you will see what I mean
Regards
Joe
Comment #4
rszrama commentedI just did create the new user and it worked fine, so I still don't see how this is an issue with the @. If you look at the function user_validate_name(), you can even see that it explicitly allows for @ in the regex:
Comment #5
artatac commentedThanks
I worked out what it was - I use my gmail account to create multiple test accounts as it allows the + sign eg artatac+tom@gmail.com, artatac+dick@gmail.com etc. Which are fine for email fields but not if drupal uses it for the name!
Regards
Joe
Comment #6
rszrama commentedAhh, ok; we should trim those out then. : D
Comment #7
artatac commentedI note that the + character is still not trimmed out - could I request this is added to the next devel release
Thanks
Joe
Comment #8
farald commented+1 to #7.
People that uses the gmail '+'-extension to their emails cannot change password, because username is invalid, and they can't change username. So admin has to manually go in & change it for them.
Comment #9
rszrama commentedNot sure why the idea didn't come to me before, but I was able to solve this by adding a customer property to the Commerce Order entity property info that sanitizes an e-mail address for use as a username. This involves trimming whitespace off the ends, replacing illegal characters with hyphens, and trimming the final result to the maximum username length. I pulled these from user_validate_name(), though I didn't accommodate everything it does as some things just won't validate for e-mail addresses to begin with. We can always update this further in the future if we need to.
Once you update to this commit, you'll need to clear your cache so the default checkout completion rule updates or update it yourself to the new property (commerce-order:mail-username) if you've already edited it. I think we should also consider a similar property for customer profiles that creates a more human-friendly username from a customer's first and last name.
Commit: http://drupalcode.org/project/commerce.git/commitdiff/59275da
Comment #10
rszrama commentedFollow-up issue posted here: #1444696: Add a customer profile username property that turns the full name into a username
Comment #12
jenlamptonI think this is a problem with core. I've created an issue for this, here:
https://drupal.org/node/2157963