Index: wp-login.php
===================================================================
--- wp-login.php	(revision 11556)
+++ wp-login.php	(working copy)
@@ -232,13 +232,14 @@
 	$user_email = apply_filters( 'user_registration_email', $user_email );
 
 	// Check the username
-	if ( $user_login == '' )
-		$errors->add('empty_username', __('<strong>ERROR</strong>: Please enter a username.'));
-	elseif ( !validate_username( $user_login ) ) {
-		$errors->add('invalid_username', __('<strong>ERROR</strong>: This username is invalid.  Please enter a valid username.'));
-		$user_login = '';
-	} elseif ( username_exists( $user_login ) )
-		$errors->add('username_exists', __('<strong>ERROR</strong>: This username is already registered, please choose another one.'));
+	if ( !empty($user_login) ) { 
+		if ( !validate_username( $user_login ) ) { 
+			$errors->add('invalid_username', __('<strong>ERROR</strong>: This username is invalid.  Please enter a valid username.')); 
+			$user_login = ''; 
+		} elseif ( username_exists( $user_login ) ) {
+			$errors->add('username_exists', __('<strong>ERROR</strong>: This username is already registered, please choose another one.')); 
+		}
+	}
 
 	// Check the e-mail address
 	if ($user_email == '') {
@@ -249,6 +250,9 @@
 	} elseif ( email_exists( $user_email ) )
 		$errors->add('email_exists', __('<strong>ERROR</strong>: This email is already registered, please choose another one.'));
 
+	if ( !$errors->get_error_code() && empty($user_login) ) 
+		$user_login = $user_email;
+
 	do_action('register_post', $user_login, $user_email, $errors);
 
 	$errors = apply_filters( 'registration_errors', $errors );
@@ -407,7 +411,7 @@
 
 <form name="registerform" id="registerform" action="<?php echo site_url('wp-login.php?action=register', 'login_post') ?>" method="post">
 	<p>
-		<label><?php _e('Username') ?><br />
+		<label><?php _e('Username (optional)') ?><br />
 		<input type="text" name="user_login" id="user_login" class="input" value="<?php echo esc_attr(stripslashes($user_login)); ?>" size="20" tabindex="10" /></label>
 	</p>
 	<p>
@@ -501,7 +505,7 @@
 <?php if ( !isset($_GET['checkemail']) || !in_array( $_GET['checkemail'], array('confirm', 'newpass') ) ) : ?>
 <form name="loginform" id="loginform" action="<?php echo site_url('wp-login.php', 'login_post') ?>" method="post">
 	<p>
-		<label><?php _e('Username') ?><br />
+		<label><?php _e('Username or Email') ?><br />
 		<input type="text" name="log" id="user_login" class="input" value="<?php echo esc_attr($user_login); ?>" size="20" tabindex="10" /></label>
 	</p>
 	<p>
Index: wp-includes/registration.php
===================================================================
--- wp-includes/registration.php	(revision 11556)
+++ wp-includes/registration.php	(working copy)
@@ -119,8 +119,14 @@
 	$user_login = sanitize_user($user_login, true);
 	$user_login = apply_filters('pre_user_login', $user_login);
 
-	if ( empty($user_nicename) )
-		$user_nicename = sanitize_title( $user_login );
+	if ( empty($user_nicename) ) { 
+		if ( $user_login == $user_email ) { 
+			$user_nicename = preg_replace("/@.*/", '', $user_email); 
+		} else { 
+			$user_nicename = $user_login; 
+		} 
+		$user_nicename = sanitize_title( $user_nicename ); 
+	}
 	$user_nicename = apply_filters('pre_user_nicename', $user_nicename);
 
 	if ( empty($user_url) )
@@ -176,26 +182,16 @@
 	if ( empty($user_registered) )
 		$user_registered = gmdate('Y-m-d H:i:s');
 
-	$user_nicename_check = $wpdb->get_var( $wpdb->prepare("SELECT ID FROM $wpdb->users WHERE user_nicename = %s AND user_login != %s LIMIT 1" , $user_nicename, $user_login));
-
-	if ($user_nicename_check) {
-		$suffix = 2;
-		while ($user_nicename_check) {
-			$alt_user_nicename = $user_nicename . "-$suffix";
-			$user_nicename_check = $wpdb->get_var( $wpdb->prepare("SELECT ID FROM $wpdb->users WHERE user_nicename = %s AND user_login != %s LIMIT 1" , $alt_user_nicename, $user_login));
-			$suffix++;
-		}
-		$user_nicename = $alt_user_nicename;
-	}
-
-	$data = compact( 'user_pass', 'user_email', 'user_url', 'user_nicename', 'display_name', 'user_registered' );
+	$user_nicename = wp_unique_user_nicename($user_nicename, $ID);
+	
+	$data = compact( 'user_login', 'user_pass', 'user_email', 'user_url', 'user_nicename', 'display_name', 'user_registered' );
 	$data = stripslashes_deep( $data );
 
 	if ( $update ) {
 		$wpdb->update( $wpdb->users, $data, compact( 'ID' ) );
 		$user_id = (int) $ID;
 	} else {
-		$wpdb->insert( $wpdb->users, $data + compact( 'user_login' ) );
+		$wpdb->insert( $wpdb->users, $data );
 		$user_id = (int) $wpdb->insert_id;
 	}
 
@@ -264,14 +260,16 @@
 		$userdata['user_pass'] = wp_hash_password($userdata['user_pass']);
 	}
 
+	// Keep trace of current user 
+	$current_user = wp_get_current_user(); 
+	
 	// Merge old and new fields with new fields overwriting old ones.
 	$userdata = array_merge($user, $userdata);
 	$user_id = wp_insert_user($userdata);
 
 	// Update the cookies if the password changed.
-	$current_user = wp_get_current_user();
 	if ( $current_user->id == $ID ) {
-		if ( isset($plaintext_pass) ) {
+		if ( isset($plaintext_pass) || $user['user_login'] != $userdata['user_login'] ) {
 			wp_clear_auth_cookie();
 			wp_set_auth_cookie($ID);
 		}
@@ -306,4 +304,33 @@
 	return wp_insert_user($userdata);
 }
 
-?>
+/** 
+ * Returns a unique nicename for a user 
+ * 
+ * @since 2.8 
+ * @see wp_insert_user() 
+ * 
+ * @param string $user_nicename The user's nicename. 
+ * @param string $user_id The user's ID. 
+ * @return string The user's nicename. 
+ */
+
+function wp_unique_user_nicename($user_nicename, $user_id) { 
+	global $wpdb; 
+
+	$user_id = (int) $user_id; 
+	$user_nicename_check = $wpdb->get_var( $wpdb->prepare("SELECT ID FROM $wpdb->users WHERE user_nicename = %s AND ID != %d LIMIT 1" , $user_nicename, $user_id)); 
+
+	if ( $user_nicename_check ) { 
+		$suffix = 2; 
+		while ( $user_nicename_check ) { 
+			$alt_user_nicename = $user_nicename . "-$suffix"; 
+			$user_nicename_check = $wpdb->get_var( $wpdb->prepare("SELECT ID FROM $wpdb->users WHERE user_nicename = %s AND ID != %d LIMIT 1" , $alt_user_nicename, $user_id)); 
+			$suffix++; 
+		}
+		$user_nicename = $alt_user_nicename;
+	}
+
+	return $user_nicename; 
+}
+?>
\ No newline at end of file
Index: wp-admin/includes/user.php
===================================================================
--- wp-admin/includes/user.php	(revision 11556)
+++ wp-admin/includes/user.php	(working copy)
@@ -133,10 +133,6 @@
 
 	$errors = new WP_Error();
 
-	/* checking that username has been typed */
-	if ( $user->user_login == '' )
-		$errors->add( 'user_login', __( '<strong>ERROR</strong>: Please enter a username.' ));
-
 	/* checking the password has been typed twice */
 	do_action_ref_array( 'check_passwords', array ( $user->user_login, & $pass1, & $pass2 ));
 
@@ -163,12 +159,13 @@
 	if (!empty ( $pass1 ))
 		$user->user_pass = $pass1;
 
-	if ( !$update && !validate_username( $user->user_login ) )
-		$errors->add( 'user_login', __( '<strong>ERROR</strong>: This username is invalid. Please enter a valid username.' ));
+	if ( !$update && !empty($user->user_login) ) { 
+		if ( !validate_username( $user->user_login ) ) 
+			$errors->add( 'user_login', __( '<strong>ERROR</strong>: This username is invalid. Please enter a valid username.' )); 
+		if ( username_exists( $user->user_login ) ) 
+			$errors->add( 'user_login', __( '<strong>ERROR</strong>: This username is already registered. Please choose another one.' )); 
+	}
 
-	if (!$update && username_exists( $user->user_login ))
-		$errors->add( 'user_login', __( '<strong>ERROR</strong>: This username is already registered. Please choose another one.' ));
-
 	/* checking e-mail address */
 	if ( empty ( $user->user_email ) ) {
 		$errors->add( 'empty_email', __( '<strong>ERROR</strong>: Please enter an e-mail address.' ), array( 'form-field' => 'email' ) );
@@ -184,6 +181,12 @@
 	if ( $errors->get_error_codes() )
 		return $errors;
 
+	if ( $update && $userdata->user_login == $userdata->user_email ) {
+		$user->user_login = $user->user_email;
+	} elseif ( !$update && empty($user->user_login) ) {
+		$user->user_login = $user->user_email;
+	}
+
 	if ( $update ) {
 		$user_id = wp_update_user( get_object_vars( $user ));
 	} else {
Index: wp-admin/user-new.php
===================================================================
--- wp-admin/user-new.php	(revision 11556)
+++ wp-admin/user-new.php	(working copy)
@@ -93,9 +93,9 @@
 ?>
 <table class="form-table">
 	<tr class="form-field form-required">
-		<th scope="row"><label for="user_login"><?php _e('Username'); ?> <span class="description"><?php _e('(required)'); ?></span></label>
+		<th scope="row"><label for="user_login"><?php _e('Username'); ?></label>
 		<input name="action" type="hidden" id="action" value="adduser" /></th>
-		<td><input name="user_login" type="text" id="user_login" value="<?php echo esc_attr($new_user_login); ?>" aria-required="true" /></td>
+		<td><input name="user_login" type="text" id="user_login" value="<?php echo esc_attr($new_user_login); ?>" /></td>
 	</tr>
 	<tr class="form-field">
 		<th scope="row"><label for="first_name"><?php _e('First Name') ?> </label></th>
Index: wp-admin/user-edit.php
===================================================================
--- wp-admin/user-edit.php	(revision 11556)
+++ wp-admin/user-edit.php	(working copy)
@@ -183,10 +183,12 @@
 <h3><?php _e('Name') ?></h3>
 
 <table class="form-table">
+<?php if ( $profileuser->user_login != $profileuser->user_email ) : ?>
 	<tr>
 		<th><label for="user_login"><?php _e('Username'); ?></label></th>
 		<td><input type="text" name="user_login" id="user_login" value="<?php echo esc_attr($profileuser->user_login); ?>" disabled="disabled" class="regular-text" /> <span class="description"><?php _e('Your username cannot be changed.'); ?></span></td>
 	</tr>
+<?php endif; ?>
 
 <?php if ( !IS_PROFILE_PAGE ): ?>
 <tr><th><label for="role"><?php _e('Role:') ?></label></th>
