Better email error checking, fixes #2046
git-svn-id: http://svn.automattic.com/wordpress/trunk@3507 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
d266a0d226
commit
f4a34c7074
|
@ -10,6 +10,14 @@ function username_exists( $username ) {
|
|||
return null;
|
||||
}
|
||||
|
||||
function email_exists( $email ) {
|
||||
global $wpdb;
|
||||
$email = addslashes( $email );
|
||||
$email_exists = $wpdb->get_row("SELECT user_email FROM $wpdb->users WHERE user_email = '$email'");
|
||||
if ( $email_exists)
|
||||
return true;
|
||||
}
|
||||
|
||||
function validate_username( $username ) {
|
||||
$name = sanitize_user($username, true);
|
||||
$valid = true;
|
||||
|
|
|
@ -33,10 +33,8 @@ case 'register':
|
|||
if ( username_exists( $user_login ) )
|
||||
$errors['user_login'] = __('<strong>ERROR</strong>: This username is already registered, please choose another one.');
|
||||
|
||||
/* checking the email isn't already used by another user */
|
||||
$email_exists = $wpdb->get_row("SELECT user_email FROM $wpdb->users WHERE user_email = '$user_email'");
|
||||
if ( $email_exists)
|
||||
die (__('<strong>ERROR</strong>: This email address is already registered, please supply another.'));
|
||||
if ( email_exists( $user_email ) )
|
||||
$errors['user_email'] = __('<strong>ERROR</strong>: This email is already registered, please choose another one.');
|
||||
|
||||
if ( 0 == count($errors) ) {
|
||||
$password = substr( md5( uniqid( microtime() ) ), 0, 7);
|
||||
|
@ -101,11 +99,11 @@ default:
|
|||
<h2><?php _e('Register for this blog') ?></h2>
|
||||
<?php if ( isset($errors) ) : ?>
|
||||
<div class="error">
|
||||
<ul>
|
||||
<p>
|
||||
<?php
|
||||
foreach($errors as $error) echo "<li>$error</li>";
|
||||
foreach($errors as $error) echo "$error<br />";
|
||||
?>
|
||||
</ul>
|
||||
</p>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<form method="post" action="wp-register.php" id="registerform">
|
||||
|
|
Loading…
Reference in New Issue