If there already exists a user with the mail address email@example.com and you want to invite this user by using EMAIL@example.com than mysql gives the correct result (because the default string comparison in mysql is not case sensitive, I don't think that even this will work in postgresql). But anyway, array_diff seems to be case sensitive so this will not work and the invalid emails will remain in $emails.:

// Keep only valid e-mails.
$emails = array_diff($emails, $failed_emails);
CommentFileSizeAuthor
#1 invite-689732-2.patch799 bytesosopolar

Comments

osopolar’s picture

Status: Active » Needs review
StatusFileSize
new799 bytes

The fix is to lowercase all email addresses in $email and $failed_emails. I guess this way we only save lower case email addresses in the invite table.

Drupal does noch change the case while saving the users mail address but it checks the case in sql-querys like:
SELECT COUNT(*) FROM {users} WHERE uid != %d AND LOWER(mail) = LOWER('%s')

smk-ka’s picture

Status: Needs review » Fixed

Thanks, this has already been fixed in the development snapshot.

YK85’s picture

Hi,

Sorry this might be a very rookie question, but how can we tell if this patch went into the latest 6.x-2.0-beta1 or if it's only in the 6.x-2.x-dev? I see the version as HEAD and not sure what that means.

Thanks so much!

smk-ka’s picture

Sorry, Yaz, I missed your question: it's listed in the changelog for beta1:

#790138 by rjbrown99: Fixed case-insensitive validation of e-mails.

YK85’s picture

i see it now, thanks!

Status: Fixed » Closed (fixed)

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