Make WordPress Core

Opened 14 years ago

Last modified 5 years ago

#14767 new defect (bug)

wp_create_user() does not check for a valid email address

Reported by: mrwiblog's profile mrwiblog Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.0
Component: Users Keywords: has-patch
Focuses: Cc:

Description

When creating a new user an invalid email address (for example user@) will result in a zero-length string in the email field of the users table. If another new user is subsequently created with another invalid email address the error returned is "This email address is already registered."

It would be better for wp_create_user() to check if a valid email address has been given and return a more descriptive error. I attach a patch file for wp-includes/registration.php to include this functionality.

Attachments (1)

registration.php.patch (161 bytes) - added by mrwiblog 14 years ago.
Patch for wp-includes/registration.php

Download all attachments as: .zip

Change History (10)

@mrwiblog
14 years ago

Patch for wp-includes/registration.php

#1 @nacin
14 years ago

  • Milestone changed from Awaiting Review to 3.1

This reminds me of a ticket or two. Not sure if there are any duplicates though.

#2 @mrwiblog
14 years ago

  • Keywords has-patch added

The nearest thing I could find was #14417, and there's also #14308 which is in 3.1. Looks like there's a bit of cleaning up that could be done in that function.

#3 follow-up: @nacin
14 years ago

Closed #14417 as a duplicate.

We should make email addresses required and enforce uniqueness. I think that will be necessary with #5919 with being able to log in with an email (though unsure if that is covered there).

#4 in reply to: ↑ 3 ; follow-up: @filosofo
14 years ago

Replying to nacin:

We should make email addresses required and enforce uniqueness.

I think we should consider doing the opposite: making email addresses just another user datum, like URL. The current system, which de facto requires email addresses, makes it tricky to implement authorization or authentication protocols such as OAuth or OpenID that don't necessarily get you a user's email address.

Aside from emailing password resets (which is not needed for sites accepting those protocols), there's not much reason for core WP to require email addresses.

#5 in reply to: ↑ 4 @jonkirkman
14 years ago

Replying to filosofo:

Replying to nacin:

We should make email addresses required and enforce uniqueness.

I think we should consider doing the opposite: making email addresses just another user datum, like URL. The current system, which de facto requires email addresses, makes it tricky to implement authorization or authentication protocols such as OAuth or OpenID that don't necessarily get you a user's email address.

Aside from emailing password resets (which is not needed for sites accepting those protocols), there's not much reason for core WP to require email addresses.

I agree with Filosofo. This seems to be more of an issue with email_exists() not being cope with being passed an empty string which is the default behavior of some of the functions which rely upon it. If email_exists() is passed an empty string, perhaps it automatically return false without searching the users table.

#6 @ryan
14 years ago

  • Milestone changed from 3.1 to Future Release

#7 @SergeyBiryukov
11 years ago

#24630 was marked as a duplicate.

#8 @SergeyBiryukov
11 years ago

  • Keywords wp_create_user is_email removed

wp_create_user() was introduced in [2872], $email became optional in [2915], apparently for the MT importer.

#9 @chriscct7
9 years ago

  • Version changed from 3.0.1 to 3.0
Note: See TracTickets for help on using tickets.