Thanks - finally got round to doing this today, and for the record,
this is what I did to get it working:

had to override hobo_login (which I copied from Hobo and pasted into
my users_controller).
I also copied the authenticate method from Hobo's user.rb, and pasted
into my user.rb.
I renamed it to self.authenticate_with_org and added the extra
parameter so it adds to the conditions string.
I then replaced the call to model.authenticate with my
User.authenticate_with_org method.

Hope that saves someone some time someday..!

Adam

On Mar 25, 10:52 am, Tom Locke <[email protected]> wrote:
> in the fields...do block you'll have
>
> email_address :email, :login => true
>
> Add :validate => false and Hobo will not validate that field
>
> Tom
>
> On 24 Mar 2009, at 12:21, adamski wrote:
>
>
>
> > I also think that authenticate is only half the story. There is some
> > code somewhere that is checking for unique users, currently by
> > email_address, which prevents a new user being created with the same
> > email_address. We need to be able to create another user with the same
> > email address but different organisation_id. I have had a look through
> > the signup process but could not find where this might be happening.
>
> > Thanks
> > Adam
>
> > On Mar 24, 12:02 pm, adamski <[email protected]> wrote:
> >> Thanks Brett
>
> >> Is there an easy way to override methods in plugins/hobo? Not sure I
> >> have it right:
>
> >> I created a file called hobo_user.rb and put it in my lib folder,  
> >> code
> >> below.
> >> I put a a line in my environment.rb
>
> >> require 'hobo_user'
>
> >> Many thanks
> >> Adam
>
> >> ................................................
>
> >> module Hobo
>
> >>   module User
>
> >>     module ClassMethods
> >>       # Authenticates a user by their login name and unencrypted
> >> password.  Returns the user or nil.
> >>       def authenticate(login, password)
> >>         u = find(:first, :conditions => ["#...@login_attribute} = ?",
> >> login]) # need to get the salt
>
> >>         RAILS_DEFAULT_LOGGER.debug "CUSTOM HOBO USER AUTH"
>
> >>         if u && u.authenticated?(password)
> >>           if u.respond_to?(:last_login_at) || u.respond_to?
> >> (:login_count)
> >>             u.last_login_at = Time.now if u.respond_to?
> >> (:last_login_at)
> >>             u.login_count = (u.login_count.to_i + 1) if u.respond_to?
> >> (:login_count)
> >>             u.save
> >>           end
> >>           u
> >>         else
> >>           nil
> >>         end
> >>       end
> >>     end
> >>   end
> >> end
>
> >> On Mar 23, 6:03 pm, Brett Nelson <[email protected]> wrote:
>
> >>> authenticate in vendor/plugins/hobo/hobo/lib/hobo/user.rb
>
> >>> Brett
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Hobo 
Users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/hobousers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to