--- modules/user.module 2005-11-01 05:17:34.000000000 -0500 +++ modules/user.module 2005-11-03 18:37:38.000000000 -0500 @@ -1068,8 +1068,11 @@ if (!form_get_errors()) { $from = variable_get('site_mail', ini_get('sendmail_from')); - $pass = $admin ? $edit['pass'] : user_password(); - + if (variable_get("user_mail_verify", '1') == 0 || $admin) { + $pass = $edit["pass"]; + } else { + $pass = user_password(); + }; // TODO: Is this necessary? Won't session_write() replicate this? unset($edit['session']); if (!$admin && array_intersect(array_keys($edit), array('uid', 'roles', 'init', 'session', 'status'))) { @@ -1091,6 +1094,15 @@ $form['pass'] = array('#type' => 'hidden', '#value' => $pass); $form['submit'] = array('#type' => 'submit', '#value' => t('Log in')); return drupal_get_form('user_register', $form); + } elseif (variable_get("user_mail_verify", '1') == 0) { + // Create new user account, no email verification is required. + $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"); + $edit["pass"] = $pass; + $edit["name"] = $account->name; + user_login($edit); + } else { if ($admin) { @@ -1127,7 +1139,7 @@ } $form['name'] = array('#type' => 'textfield', '#title' => t('Username'), '#default_value' => $edit['name'], '#size' => 30, '#maxlength' => 64, '#description' => t('Your full name or your preferred username; only letters, numbers and spaces are allowed.'), '#required' => TRUE); $form['mail'] = array('#type' => 'textfield', '#title' => t('E-mail address'), '#default_value' => $edit['mail'], '#size' => 30, '#maxlength' => 64, '#description' => t('A 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_mail_verify", '1') == 0 || $admin) { $form['pass'] = array('#type' => 'password', '#title' => t('Password'), '#default_value' => $edit['pass'], '#size' => 30, '#maxlength' => 55, '#description' => t('Provide a password for the new account.'), '#required' => TRUE); } $extra = _user_forms($edit, $account, $category, 'register'); @@ -1758,6 +1770,7 @@ // 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_mail_verify'] = array('#type' => 'checkbox', '#title' => t('Require email verification when a visitor creates an account'), '#return_value' => 1, '#default_value' => 0, '#description' => t('Check this box to require email verification.')); $form['registration']['user_registration_help'] = array('#type' => 'textarea', '#title' => t('User registration guidelines'), '#default_value' => variable_get('user_registration_help', ''), '#cols' => 60, '#rows' => 5, '#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.