Index: modules/user.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/user.module,v
retrieving revision 1.620
diff -F^f -u -r1.620 user.module
--- modules/user.module	7 May 2006 03:52:34 -0000	1.620
+++ modules/user.module	7 May 2006 20:47:17 -0000
@@ -1172,16 +1172,18 @@ function user_register() {
     '#title' => t('E-mail address'),
     '#size' => 30,
     '#maxlength' => 64,
-    '#description' => t('A password and instructions will be sent to this e-mail address, so make sure it is accurate.'),
+    '#description' => t('Your password and instructions will be sent to this e-mail address, so make sure it is accurate.'),
     '#required' => TRUE,
   );
-  if ($admin) {
+  if (!variable_get('user_email_verification', TRUE) || $admin) {
     $form['pass'] = array('#type' => 'password',
       '#title' => t('Password'),
       '#size' => 30,
       '#description' => t('Provide a password for the new account.'),
       '#required' => TRUE,
     );
+  }
+  if ($admin) {
     $form['notify'] = array(
      '#type' => 'checkbox',
      '#title' => t('Notify user of new account')
@@ -1215,7 +1217,12 @@ function user_register_submit($form_id, 
 
   $mail = $form_values['mail'];
   $name = $form_values['name'];
-  $pass = $admin ? $form_values['pass'] : user_password();
+  if (variable_get('user_email_verification', 1) == 0 || $admin) {
+    $pass = $form_values['pass'];
+  } 
+  else {
+    $pass = user_password();
+  };
   $notify = $form_values['notify'];
   $from = variable_get('site_mail', ini_get('sendmail_from'));
 
@@ -1247,6 +1254,14 @@ function user_register_submit($form_id, 
 
       return 'admin/user';
     }
+    else if (variable_get('user_email_verification', 1) == 0 && $account->status && !$admin) {
+      // No e-mail verification is required, create new user account, and login user immediately.
+      $subject = _user_mail_text('welcome_subject', $variables);
+      $body = _user_mail_text('welcome_body', $variables);
+      user_mail($edit['mail'], $subject, $body, "From: $from\nReply-to: $from\nX-Mailer: Drupal\nReturn-path: $from\nErrors-to: $from");
+      user_authenticate($account->name, trim($pass));
+      drupal_goto();
+    }
     else if ($account->status || $notify) {
       // Create new user account, no administrator approval required.
       $subject = $notify ? _user_mail_text('admin_subject', $variables) : _user_mail_text('welcome_subject', $variables);
@@ -1935,6 +1950,7 @@ function user_configure() {
   // User registration settings.
   $form['registration'] = array('#type' => 'fieldset', '#title' => t('User registration settings'));
   $form['registration']['user_register'] = array('#type' => 'radios', '#title' => t('Public registrations'), '#default_value' => variable_get('user_register', 1), '#options' => array(t('Only site administrators can create new user accounts.'), t('Visitors can create accounts and no administrator approval is required.'), t('Visitors can create accounts but administrator approval is required.')));
+  $form['registration']['user_email_verification'] = array('#type' => 'checkbox', '#title' => t('Require e-mail verification when a visitor creates an account'), '#return_value' => 1, '#default_value' => variable_get('user_email_verification', 1), '#description' => t('Check this box to require e-mail verification.'));
   $form['registration']['user_registration_help'] = array('#type' => 'textarea', '#title' => t('User registration guidelines'), '#default_value' => variable_get('user_registration_help', ''), '#description' => t('This text is displayed at the top of the user registration form. It\'s useful for helping or instructing your users.'));
 
   // User e-mail settings.
