My ruby is a bit weak, but it looks like it is happening in an
accessor function here:
def login_attribute=(attr, validate=true)
@login_attribute = attr = attr.to_sym
unless attr == :login
alias_attribute(:login, attr)
declare_attr_type(:login, attr_type(attr)) if table_exists?
# this breaks if the table doesn't exist
end
if validate
validates_length_of attr, :within => 3..100
--> validates_uniqueness_of attr, :case_sensitive => false
end
end
Brett
On Mar 24, 6:21 am, adamski <[email protected]> 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
-~----------~----~----~----~------~----~------~--~---