LoginEngine: using email addresses as logins?

Didn’t see this on the list anywhere, so I figured I’d bring it up.

LoginEngine has a separate concept of login id & email address, as well
as fields for firstname and lastname.

For my app I was considering having no first/last storage and using
email addresses as logins – or at least allowing email address to be
the ID a user uses (there certainly is value in allowing an account to
switch email address values over time).

Has there ever been any discussion about having this as an option for
LoginEngine? Or is this custom enough that I should just DRY it?

–dwf

DWFrank wrote:

For my app I was considering having no first/last storage and using
email addresses as logins – or at least allowing email address to be
the ID a user uses (there certainly is value in allowing an account to
switch email address values over time).

We have exactly the same requirement here, so I’d be interested too to
see if we can use LE for this…

d

DWFrank wrote:

For my app I was considering having no first/last storage

I don’t believe the firstname and lastname fields are required.
Therefore you could just drop them from the schema. Obviously you will
need to override the signup template to not ask for these fields. This
is just speculation since my app is accepting first and last name.

and using
email addresses as logins – or at least allowing email address to be
the ID a user uses (there certainly is value in allowing an account to
switch email address values over time).

I did the following in my user model to handle this:

class User < ActiveRecord::Base
# Mixin free user functionality from login engine
include LoginEngine::AuthenticatedUser

# Username should always match email address
before_validation do |r|
	r.login = r.email
end

end

This way anytime the email address is changed the login name will change
also automatically. I just adjusted all templates to say “Email Address”
instead of “User ID” (or whatever the old label was). Internally the
login field is still used but from the user’s perspective they are only
managing an email address.

Eric

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs