diff --git a/email_registration.module b/email_registration.module index f74784a..3311271 100644 --- a/email_registration.module +++ b/email_registration.module @@ -47,14 +47,6 @@ function email_registration_user_insert(&$edit, &$account, $category = NULL) { ->execute(); $edit['name'] = $new_name; - - // If email verification is off and a new user is the one creating an account, - // log the new user in with his correct name. - global $user; - if (!variable_get('user_email_verification', 1) && $user->uid == 0) { - $user = $account; - $user->name = $new_name; - } $account->name = $new_name; return; } diff --git a/email_registration.test b/email_registration.test index ea5a8a4..55187af 100644 --- a/email_registration.test +++ b/email_registration.test @@ -49,8 +49,21 @@ class EmailRegistrationTestCase extends DrupalWebTestCase { ); $this->drupalPost('user/login', $login, t('Log in')); - // Really basic confirmatino that the user was created and logged in. + // Really basic confirmation that the user was created and logged in. $this->assertRaw('' . $name . ' | Drupal', t('User properly created, logged in.')); + // Now try the immediate login. + $this->drupalLogout(); + variable_set('user_email_verification', 0); + $name = $this->randomName(); + $pass = $this->randomName(10); + $register = array( + 'mail' => $name . '@example.com', + 'pass[pass1]' => $pass, + 'pass[pass2]' => $pass, + ); + $this->drupalPost('/user/register', $register, t('Create new account')); + $this->assertRaw('Registration successful. You are now logged in.', t('User properly created, immediately logged in.')); + } }