It alllows email login for first time, but once I am logged out. I can login to the site with either using my email or my predefined username.

It doesn't make a much difference compared to LoginToboggan. It would be interesting to see if you could change it to allow login with only email and user able to edit his/her username display, something like most social networks are applying these days.

Anyways, thanks for the modules. Hope to see a newer revision soon.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Christopher Herberte’s picture

Hi Yee, thanks for the feedback.
Would you use a feature where logging in with the "Display Name" (aka username) would be disabled. If so I may add the feature which could be configurable within an admin setup.

The username is changeable by the user, you must enable this in user access though. (admin/user/access - [X] change own username)

I will release a newer version if i can get enough reasonable requests for changes.

Chris.

yeeloon’s picture

Hi Chris,

Yup! That would come in handy.

Fool2’s picture

Looking at the code, this module uses the EXACT SAME validation method as logintoboggan.

function logintoboggan_user_login_validate($form_id, $form_values, $form) {
  if (isset($form_values['name'])) {
    if ($name = db_result(db_query("SELECT name FROM {users} WHERE LOWER(mail) = LOWER('%s')", $form_values['name']))) {
      form_set_value($form['name'], $name);
    }
  }
}
function email_registration_user_login_validate($form_id, $form_values, $form) {
  if (isset($form_values['name'])) {
    if ($name = db_result(db_query("SELECT name FROM {users} WHERE LOWER(mail) = LOWER('%s')", $form_values['name']))) {
      form_set_value($form['name'], $name);
    }
  }
}

This method will NOT let us do what we want without dangerous hackery. The way that the email is added to the login validation needs to be changed.

I will make it happen and report back with results.

Christopher Herberte’s picture

Any help would be hugely appreciated. I've been a but snowed under ATM. Thanks for your help

Chris Charlton’s picture

Did this get resolved?

Fool2’s picture

Here's some dangerous hackery:

In email_registration_user:

  case 'load':
          $account->name = $account->profile_fullname;
	  break;
  case 'validate':
        global $form_values;
        $form_values['name'] = $form_values['mail'];
        break;

In my case I needed to do TWO things. I wanted to have email logins and eliminate the unique username concept all together and just have a profile field (profile_fullname) as the display name.

This only works if you use module_weight to put profile module ahead of this so that the profile values are available in the user object. Also you want email_registration itself to have a light weight (though come after profile module) so that the display name modification hopefully comes through

This results in the email address populating both the username and email fields. With proper form_alter hacking one can remove reference to username in the registration form (which is already done in the current version of this module but needs some tweaking)

So if we hack the module enough we can get email_registration_user_login_validate to be irrelevant. My site is not yet in production so I am not sure my code is completely safe.

Also note that you will need to override theme_username if you don't want the email displayed. Once I'm absolutely sure that my modifications work cleanly and efficiently I'll find and share all the necessary modifications

scottrigby’s picture

This would be great - but I'm not confident in my drupaling to want to try it out with the above warnings as they stand now

Fool2, did you find out anything else about this since this last post?

Thanks
Scott

Fool2’s picture

  case 'load':
          $account->name = $account->profile_fullname;

I ended up having to remove this code because it was interfering with a lot of forms.

Here are some other problems I came up with trying to implement a system that essentially doesn't have username

--Using the email address presents a security problem that is hard to solve
--Without a unique username it is more difficult to implement forms that take username as an input. These forms are mostly autocompletes (such as the node authoring) which is a problem because there needs to be a unique value entered. Current autocomplete functionality does not support hidden values for passing the uid, which means that the name would have to be passed like the node references are right now like so:

John Doe [uid:8]

This is ugly and not ideal.

I am going to move the rest of the discussion on using full names into another thread because I think we're getting off topic here.

doublejosh’s picture

I'm using Logintoboggan and Email Registration on Drupal 5.

I see that ER automatically creates a hash value for the initial username, which is then changed to their email prefix upon registration.
Since the function which inserts numbers if this is a duplicate keeps them unique, and the user can change it if they like... I feel like module gets rid of the "pick a username hurdle/switching-cost" which was my main goal.

The problem left behind is the (not defined by choice) username showing up on the site upon initial site use.

If it was registration ease is what you're looking for who cares.
I've changed line 1309 of user.module to say "Display Name" rather than "Username", this way people know this is how they will publicly appear.
'#title' => t('Display Name'),

You can also have "First Name" and "Last Name" fields in a "Contact" section of user info if that's appropriate for your site.
However the goal of easy registration is solved as in initial username and personal choice in name display privacy.
Seems ok for me.

Remaining "BUG" people can log in with their display name... this is hardly a bug. It's a feature!

Christopher Herberte’s picture

Thanks doublejosh
On the site for which this module was designed, I use "Display name" to replace username also -- in 'my account'. This is a feature which I can add to the module, with admin option of changing this title as it can be modified with a theme hook (avoiding editing core)

Also the bug/feature of logging in with username could added as an admin option / checkbox. I see no problem with that.

I'll add these both as new issues for code.

Cheers, Chris.

doublejosh’s picture

Version: 6.x-1.0 » 5.x-1.x-dev

Furthermore, you can change the places where a user is told what to enter to just say "email"

Example: Line 156 of logintoboggan.module changed to $form['name']['#title'] = t('email');

I imagine there are a few other spots where "Username" or "Username or e-mail" is referred to.

This way only the exceptionally clever will even know you can log in with one's unique "username" as well... if that's how you want it.

I apologize for not speaking to any security risks in this thread... but my module comes before the "dangerous hackery" and profile_name usage.

Fool2’s picture

Okay, well I moved this discussion to http://drupal.org/node/207092

My goals go beyond that of email registration. Email login is a central feature of my concept, though, and to make the username unimportant is also one. Unfortunately, I also want to keep the email address private and have a non-email display name for the user.

Christopher Herberte’s picture

Fool2, I'm not certain that what you are proposing is in fact is beyond the scope of email_registration functionality. By using the user name field as 'full name' is a possible solution. usernames can contain spaced and capitalization. I read your post http://drupal.org/node/207092

Avoiding the requirement for profile module is preferable and I'm thinking this can be achieved without profile module. There is a problem with usernames needing to be unique but really, how many users are going to have the same full name? Unless the userbase is quite large this would not be a problem.

It would be nice to have email_registration function as close as possible to your requirement and I would like to help achieve this.

garg_art’s picture

Version: 5.x-1.x-dev » 6.x-1.0

On Drupal 6.1, using 6.x-1.0 - I find the registration works like charm.
After all the good stuff, on return, login using name also works like a charm.
But email login does not work and it rejects the password.

Since the screen now asks for email address, it no longer is expected that users will even think of logging using username.

While we debug this, is there a simple way to change to username "only" on the login screen and allow the email based registration to exist.

Ideal solution would be to remedy the defect.

Thanks and this is very powerful feature worthy (IMHO) of it being in the core.

Best Regards

garg_art’s picture

Ignore this post .....

I found out that I had to install alternate log in and after that it works like a charm. Yippeee!!

caligari’s picture

Version: 5.x-1.x-dev » 6.x-1.0

I think email_registration module have not got any dependencies from alt_login module. It pseudo-solves your problem because the user can put the email as alternate login name. However, email_registration must validate login with the user email, with or without alt_login...

The bug is confirmed in email_registration 6.x-1.0 with drupal 6.2.

moshe weitzman’s picture

Category: support » feature
Priority: Normal » Minor

Chris' proposal in #10 look like a good way forward for this. Just add two checkboxes and maybe a textfield to rename username to something like 'display name'

Christopher Herberte’s picture

Assigned: Unassigned » Christopher Herberte
Priority: Minor » Normal
greggles’s picture

Title: Using username can still login » Change "username" field to "Display Name"
Version: 6.x-1.0 » 7.x-1.x-dev
Assigned: Christopher Herberte » Unassigned

Now that some of the ideas here have been split out to #657472: Add setting to allow users to login with email address or username the remaining idea is to rename the "User name" field to "Display Name" which makes sense to me.

greggles’s picture

Status: Active » Needs review
FileSize
465 bytes

FWIW, I could also see just not doing this patch and instead adding a comment in README.txt about how to fix this in a string override style fix (which is how we will fix #1546054: Add README.txt idea to fix confusing validation message).

greggles’s picture

Version: 7.x-1.x-dev » 6.x-1.x-dev
Status: Needs review » Patch (to be ported)
greggles’s picture

Title: Change "username" field to "Display Name" » Change 'username' field to 'Display name'
Status: Patch (to be ported) » Fixed

I realized when testing and committing this to 6.x that it needs to be Display name with a lower case N on name because of the standard of sentence casing. So, fixed that in 6.x and 7.x

http://drupalcode.org/project/email_registration.git/commit/3815aa0 and http://drupalcode.org/project/email_registration.git/commit/73e4e49 respectively.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.