Forum: Rails Engines development LoginEngine mod

Posted by Jason Lee (Guest)
on 2006-08-23 02:12
(Received via mailing list)
Hi all,

I've looked thru the list and haven't seen an answer for something I'm
looking to do.

I just started a new project and we're used to always using a user's
email address as the login. The LoginEngine, however, has a login
field. I started poking thru the engine code to see how hard this
might be to extend/override and it sorta looks like it might be a
little involved.

My original idea was just to extend the User model and assign the
email address to the login field behind the scenes. However, when I do
this the validation fails (obviously). The login field is pretty
critical to the whole structure and I was just wondering if someone
else has tried and succeeded with this?

tia,

- jason
Posted by Eric Anderson (Guest)
on 2006-08-23 15:41
(Received via mailing list)
Jason Lee wrote:
> I just started a new project and we're used to always using a user's
> email address as the login. The LoginEngine, however, has a login
> field. I started poking thru the engine code to see how hard this
> might be to extend/override and it sorta looks like it might be a
> little involved.

I just created a user.rb file in my application models directory that
looks like this:

class User < ActiveRecord::Base
   include LoginEngine::AuthenticatedUser
   before_validation do |r|
     r.login = r.email
   end
end

Seems to be working well so far.

Eric
Posted by Jason Lee (Guest)
on 2006-08-23 16:03
(Received via mailing list)
Ah, perfect. And apologies for posting to the dev list as I didn't
see the users list.

Thx!

-jason
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.