Tom Taylor
2006-Jan-02 13:12 UTC
[Rails] Login_engine - auth against email rather that username?
Hi all, Short of hacking the code apart, is there a method making the login_engine authenticate against email address rather than username? I find that people rarely remember usernames, and would prefer to use email addresses as the identifier. Thanks! Tom
Nathaniel S. H. Brown
2006-Jan-02 13:25 UTC
[Rails] Login_engine - auth against email rather that username?
Simple fix would be to remove the email field from the app/view/signup.rhtml and rename the username field to email in the text. What they put into the username field doesn''t much make a difference, as long as it is a string. -Nb ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Nathaniel S. H. Brown http://nshb.net ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~> -----Original Message----- > From: rails-bounces@lists.rubyonrails.org > [mailto:rails-bounces@lists.rubyonrails.org] On Behalf Of Tom Taylor > Sent: January 2, 2006 5:13 AM > To: rails@lists.rubyonrails.org > Subject: [Rails] Login_engine - auth against email rather > that username? > > Hi all, > > Short of hacking the code apart, is there a method making the > login_engine authenticate against email address rather than username? > > I find that people rarely remember usernames, and would > prefer to use email addresses as the identifier. > > Thanks! > > Tom > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
Derek Haynes
2006-Jan-02 14:27 UTC
[Rails] Login_engine - auth against email rather that username?
I think you have do a couple more things because the user model won''t validate if a login is not provided. I just re-included the LoginEngine::AuthenticatedUser module in my User model and commented out the following lines: # We aren''t using the login and need to comment it out # validates_presence_of :login, :on => :create # validates_length_of :login, :within => 3..40, :on => :create # validates_uniqueness_of :login, :on => :create Cheers, Derek On 1/2/06, Nathaniel S. H. Brown <nshb@inimit.com> wrote:> Simple fix would be to remove the email field from the app/view/signup.rhtml > and rename the username field to email in the text. > > What they put into the username field doesn''t much make a difference, as > long as it is a string. > > -Nb > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > Nathaniel S. H. Brown http://nshb.net > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > > > -----Original Message----- > > From: rails-bounces@lists.rubyonrails.org > > [mailto:rails-bounces@lists.rubyonrails.org] On Behalf Of Tom Taylor > > Sent: January 2, 2006 5:13 AM > > To: rails@lists.rubyonrails.org > > Subject: [Rails] Login_engine - auth against email rather > > that username? > > > > Hi all, > > > > Short of hacking the code apart, is there a method making the > > login_engine authenticate against email address rather than username? > > > > I find that people rarely remember usernames, and would > > prefer to use email addresses as the identifier. > > > > Thanks! > > > > Tom > > > > _______________________________________________ > > Rails mailing list > > Rails@lists.rubyonrails.org > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-- Derek Haynes HighGroove Studios - http://www.highgroove.com Atlanta, GA Keeping it Simple. 404.593.4879
Francois Beausoleil
2006-Jan-02 17:54 UTC
[Rails] Login_engine - auth against email rather that username?
Hello Tom ! 2006/1/2, Tom Taylor <tom@tomtaylor.co.uk>:> Short of hacking the code apart, is there a method making the > login_engine authenticate against email address rather than username?I simply added a before_validation filter that copies the email field to the username field. Then, I lenghtened the login field to accomodate E-Mails. Hope that helps ! -- Fran?ois Beausoleil http://blog.teksol.info/
James Adam
2006-Jan-02 18:26 UTC
[Rails] Login_engine - auth against email rather that username?
This is all probably indicative of a need to distinguish the ''user profile'' information (name, birthday, favourite colour) from the actual authentication information (id & password/phrase). Perhaps the real way forward is either/or/both of: a) removing the extraneous information (currently the name and email*) from the authentication system, and b) giving developers a fairly intuitive means of defining their own validations on the id field - or a means of selecting between a few existing ones (login, email address, something else...) The stealth-launched new site (http://rails-engines.org) has a link to the Trac system. Someone submit a ticket, close your eyes and click the heels of your ruby slippers three times, and perhaps it might get done ;-) - james * note that removing the guarantee that one field will contain a valid email address means that email notification has to be reworked too. On 1/2/06, Francois Beausoleil <francois.beausoleil@gmail.com> wrote:> Hello Tom ! > > 2006/1/2, Tom Taylor <tom@tomtaylor.co.uk>: > > Short of hacking the code apart, is there a method making the > > login_engine authenticate against email address rather than username? > > I simply added a before_validation filter that copies the email field > to the username field. Then, I lenghtened the login field to > accomodate E-Mails. > > Hope that helps ! > -- > Fran?ois Beausoleil > http://blog.teksol.info/ > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails > > >
Tom Taylor
2006-Jan-02 19:21 UTC
[Rails] Re: Login_engine - auth against email rather that username?
Tom Taylor wrote:> Short of hacking the code apart, is there a method making the > login_engine authenticate against email address rather than username?Hi all, Thanks for your responses. I''ve managed to make it work by just simply changing most instances of the ''login'' variable to ''email'' and removing/tweaking the validation lines. The code isn''t very complex, and a bit of following it all through did me some good. In a future version, a flag in the config would be ideal, allowing you to auth against whatever field you wanted. Login_engine is great work though - saved me a lot of time writing my own system! Thanks again, Tom
Nathaniel S. H. Brown
2006-Jan-02 23:09 UTC
[Rails] Login_engine - auth against email rather that username?
I was not inferring that he delete the login column and field, rather to remove the email field and use the login field for both the email and username. I see under the validation that you would likely have to extend the length_of below for the login field to more adequately compensate for the longer email addresses. You still want to ensure that the email is unique, present, So I suggest only modifying the following line in LoginEngine::Authenticated to the following. validates_length_of :login, :within => 5..255, :on => :create Regards, Nathaniel. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Nathaniel S. H. Brown http://nshb.net ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~> -----Original Message----- > From: rails-bounces@lists.rubyonrails.org > [mailto:rails-bounces@lists.rubyonrails.org] On Behalf Of Derek Haynes > Sent: January 2, 2006 6:28 AM > To: rails@lists.rubyonrails.org > Subject: Re: [Rails] Login_engine - auth against email rather > that username? > > I think you have do a couple more things because the user > model won''t validate if a login is not provided. > > I just re-included the LoginEngine::AuthenticatedUser module > in my User model and commented out the following lines: > > # We aren''t using the login and need to comment it out > # validates_presence_of :login, :on => :create > # validates_length_of :login, :within => 3..40, :on => :create > # validates_uniqueness_of :login, :on => :create > > Cheers, > > Derek > > > > On 1/2/06, Nathaniel S. H. Brown <nshb@inimit.com> wrote: > > Simple fix would be to remove the email field from the > > app/view/signup.rhtml and rename the username field to > email in the text. > > > > What they put into the username field doesn''t much make a > difference, > > as long as it is a string. > > > > -Nb > > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > Nathaniel S. H. Brown http://nshb.net > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > > > > > > -----Original Message----- > > > From: rails-bounces@lists.rubyonrails.org > > > [mailto:rails-bounces@lists.rubyonrails.org] On Behalf Of > Tom Taylor > > > Sent: January 2, 2006 5:13 AM > > > To: rails@lists.rubyonrails.org > > > Subject: [Rails] Login_engine - auth against email rather that > > > username? > > > > > > Hi all, > > > > > > Short of hacking the code apart, is there a method making the > > > login_engine authenticate against email address rather > than username? > > > > > > I find that people rarely remember usernames, and would prefer to > > > use email addresses as the identifier. > > > > > > Thanks! > > > > > > Tom > > > > > > _______________________________________________ > > > Rails mailing list > > > Rails@lists.rubyonrails.org > > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > > > _______________________________________________ > > Rails mailing list > > Rails@lists.rubyonrails.org > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > -- > Derek Haynes > HighGroove Studios - http://www.highgroove.com Atlanta, GA > Keeping it Simple. > 404.593.4879 > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >