summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2006-08-03 13:50:53 +0000
committerDries Buytaert <dries@buytaert.net>2006-08-03 13:50:53 +0000
commit4b9a3cf73ea6f4ffe5a9f18747ecad043a32a14f (patch)
tree68159e4bec575dffea3370f284d567e93f6056b3 /modules
parentfb7ebf2fc1709ed6771184a5e2043ffb431a21eb (diff)
downloadbrdo-4b9a3cf73ea6f4ffe5a9f18747ecad043a32a14f.tar.gz
brdo-4b9a3cf73ea6f4ffe5a9f18747ecad043a32a14f.tar.bz2
- Patch #4942 by webchik et al: e-mail verification is optional now.
Diffstat (limited to 'modules')
-rw-r--r--modules/user/user.module28
1 files changed, 20 insertions, 8 deletions
diff --git a/modules/user/user.module b/modules/user/user.module
index e95a8921a..740e14431 100644
--- a/modules/user/user.module
+++ b/modules/user/user.module
@@ -1184,7 +1184,12 @@ function user_register_submit($form_id, $form_values) {
$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'])) {
@@ -1213,6 +1218,14 @@ function user_register_submit($form_id, $form_values) {
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);
@@ -1266,15 +1279,13 @@ function user_edit_form($uid, $edit, $register = FALSE) {
);
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,
);
}
@@ -1912,7 +1923,8 @@ 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_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.'));
+ $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('If this box is checked, new users will be required to validate their e-mail address prior to logging into to the site, and will be assigned a system-generated password. With it unchecked, users will be logged in immediately upon registering, and may select their own passwords during registration.'));
+ $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.
$form['email'] = array('#type' => 'fieldset', '#title' => t('User e-mail settings'));