--- /home/amanuel/drupal/drupal-4.6.2/modules/user.module	2005-06-01 16:16:04.000000000 -0400
+++ user.module	2005-07-22 18:03:03.000000000 -0400
@@ -970,8 +970,11 @@
 
     if (!form_get_errors()) {
       $from = variable_get('site_mail', ini_get('sendmail_from'));
-      $pass = user_password();
-
+      if(!$edit["pass"]) {
+      	$pass = user_password();
+	  } else {
+	  	$pass =  $edit["pass"];
+	  };
       // TODO: Is this necessary? Won't session_write() replicate this?
       unset($edit['session']);
       if (array_intersect(array_keys($edit), array('uid', 'roles', 'init', 'session', 'status'))) {
@@ -993,8 +996,19 @@
         $output .= form_hidden('pass', $pass);
         $output .= form_submit(t('Log in'));
         return form($output);
-      }
-      else {
+      } 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");
+		$output .= "Your account has been created, click login below for immediate access.<p>Note, your password is <strong>$pass</strong></p>";
+		$output .= form_hidden('destination', $edit['destination']);
+		$output .= form_hidden('name', $account->name);
+		$output .= form_hidden('pass', $pass);
+		$output .= form_submit(t('Log in'));
+		return form($output);
+      
+      } else {
         if ($account->status) {
           // Create new user account, no administrator approval required.
           $subject = _user_mail_text('welcome_subject', $variables);
@@ -1016,6 +1030,9 @@
   }
 
   // Display the registration form.
+  if (empty($edit)) {
+    $edit['destination'] = $_GET['destination'];
+  }
   $output .= variable_get('user_registration_help', '');
   $affiliates = user_auth_help_links();
   if (count($affiliates) > 0) {
@@ -1023,9 +1040,13 @@
     $output .= '<p>'. t('Note: if you have an account with one of our affiliates (%s), you may <a href="%login_uri">login now</a> instead of registering.', array('%s' => $affiliates, '%login_uri' => url('user'))) .'</p>';
   }
   $default = form_textfield(t('Username'), 'name', $edit['name'], 30, 64, t('Your full name or your preferred username; only letters, numbers and spaces are allowed.'), NULL, TRUE);
-  $default .= form_textfield(t('E-mail address'), 'mail', $edit['mail'], 30, 64, t('A password and instructions will be sent to this e-mail address, so make sure it is accurate.'), NULL, TRUE);
+  $default .= form_textfield(t('E-mail address'), 'mail', $edit['mail'], 30, 64, t('Your password and instructions will be sent to this e-mail address, so make sure it is accurate.'), NULL, TRUE);
+  if (variable_get("user_mail_verify", '1') == 0) {
+    $default .= form_password(t("Password"), "pass", $edit["pass"], 30, 55, t("Provide a password for the new account. Your password must contain at least %num characters.", array("%num" => variable_get("user_password_length", 6))));
+  }
   $extra = _user_forms($edit, $account, $category, 'register');
   // Only display form_group around default fields if there are other groups.
+  $default .= form_hidden('destination', $edit['destination']);
   if ($extra) {
     $output .= form_group(t('Account information'), $default);
     $output .= $extra;
@@ -1277,6 +1298,7 @@
 function user_configure_settings() {
   // User registration settings.
   $group = form_radios(t('Public registrations'), 'user_register', variable_get('user_register', 1), 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.')));
+  $group .= form_checkbox(t('Email verification'), 'user_mail_verify', 1, variable_get('user_mail_verify', 1), t('Check this box to require email verification.'));
   $group .= form_textarea(t('User registration guidelines'), 'user_registration_help', variable_get('user_registration_help', ''), 70, 4, t('This text is displayed at the top of the user registration form.  It\'s useful for helping or instructing your users.'));
   $output = form_group(t('User registration settings'), $group);
 
