latest kickstart working really well.
one issue is that if anon user buys something their username defaults to their email address. But when they log on drupal complains that the username contains an illegal character (@) - just fyi. Suggest that you simply strip out the @

Comments

rszrama’s picture

Hmm, I'm not sure it's the @. I don't have any problems with it. Can e-mail addresses contain other non-standard characters?

artatac’s picture

Sorry - 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

artatac’s picture

or 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

rszrama’s picture

I 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:

  if (preg_match('/[^\x{80}-\x{F7} a-z0-9@_.\'-]/i', $name)) {
    return t('The username contains an illegal character.');
  }
artatac’s picture

Thanks
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

rszrama’s picture

Ahh, ok; we should trim those out then. : D

artatac’s picture

I note that the + character is still not trimmed out - could I request this is added to the next devel release

Thanks

Joe

farald’s picture

+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.

rszrama’s picture

Status: Active » Fixed

Not 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

rszrama’s picture

Status: Fixed » Closed (fixed)

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

jenlampton’s picture

I think this is a problem with core. I've created an issue for this, here:
https://drupal.org/node/2157963