? .DS_Store
? .cache
? .project
? .projectOptions
? .settings
? add-cvs-id_1.patch
? admin_page.patch
? blah.patch
? fix_password_confirm.patch
? gender-specific.patch
? patch.patch
? protect-profile-files_0.patch
? regextest.php
? single-step-account.patch
? user.patch
? user_module_HEAD.patch.txt
? user_signatures.patch
? modules/.DS_Store
? modules/user/user.module1
? sites/localhost
Index: includes/form.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/form.inc,v
retrieving revision 1.130
diff -u -F^f -r1.130 form.inc
--- includes/form.inc 22 Jul 2006 19:26:58 -0000 1.130
+++ includes/form.inc 30 Jul 2006 14:52:43 -0000
@@ -839,15 +839,23 @@ function theme_radios($element) {
* A themed HTML string representing the form item.
*/
function theme_password_confirm($element) {
- return theme('form_element', $element, '
'. $element['#children'] .'
');
+ return theme('form_element', $element, $element['#children']);
}
/*
* Expand a password_confirm field into two text boxes.
*/
function expand_password_confirm($element) {
- $element['pass1'] = array('#type' => 'password', '#size' => 12, '#value' => $element['#value']['pass1']);
- $element['pass2'] = array('#type' => 'password', '#size' => 12, '#value' => $element['#value']['pass2']);
+ $element['pass1'] = array(
+ '#type' => 'password',
+ '#title' => t('Password'),
+ '#value' => $element['#value']['pass1'],
+ );
+ $element['pass2'] = array(
+ '#type' => 'password',
+ '#title' => t('Confirm password'),
+ '#value' => $element['#value']['pass2'],
+ );
$element['#validate'] = array('password_confirm_validate' => array());
$element['#tree'] = TRUE;
Index: modules/user/user.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/user/user.module,v
retrieving revision 1.642
diff -u -F^f -r1.642 user.module
--- modules/user/user.module 29 Jul 2006 17:56:41 -0000 1.642
+++ modules/user/user.module 30 Jul 2006 14:52:44 -0000
@@ -1175,7 +1175,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', TRUE) || $admin) {
+ $pass = $form_values['pass'];
+ }
+ else {
+ $pass = user_password();
+ };
$notify = $form_values['notify'];
$from = variable_get('site_mail', ini_get('sendmail_from'));
if (isset($form_values['roles'])) {
@@ -1208,6 +1213,14 @@ function user_register_submit($form_id,
if ($admin && !$notify) {
drupal_set_message(t('Created a new user account. No e-mail has been sent.'));
}
+ else if (!variable_get('user_email_verification', TRUE) && $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);
+ drupal_mail('user-register-welcome', $mail, $subject, $body, $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);
@@ -1261,15 +1274,13 @@ function user_edit_form($uid, $edit, $re
);
if (!$register) {
$form['account']['pass'] = array('#type' => 'password_confirm',
- '#title' => t('Password'),
'#description' => t('To change the current user password, enter the new password in both fields.'),
);
}
- elseif ($register && $admin) {
- $form['account']['pass'] = array('#type' => 'password',
- '#title' => t('Password'),
- '#size' => 30,
- '#description' => t('Provide a password for the new account.'),
+ elseif (!variable_get('user_email_verification', TRUE) || $admin) {
+ $form['account']['pass'] = array(
+ '#type' => 'password_confirm',
+ '#description' => t('Provide a password for the new account in both fields.'),
'#required' => TRUE,
);
}
@@ -1907,6 +1918,7 @@ function user_admin_settings() {
// 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'), '#default_value' => variable_get('user_email_verification', TRUE), '#description' => t('Uncheck this box to allow new registrants to create own password and immediately login.'));
$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.