James Byrne wrote:
> I am puzzled over how to normalize the login value provided by the user
> to authlogic to validate the existence of that user. I have threaded
> my way through the code and tried to understand what it and the examples
> are trying to tell me but I am just not making the connections.
This seems to be the place where the problem lies:
[150, 159] in
/usr/lib/ruby/gems/1.8/gems/authlogic-1.3.7/lib/authlogic/session/base.rb
150 def credentials=(values)
151 return if values.blank? || !values.is_a?(Hash)
152 values.symbolize_keys!
153 values.each do |field, value|
154 next if value.blank?
=> 155 send("#{field}=", value)
156 end
157 end
158
159 # Resets everything, your errors, record, cookies, and
session. Basically "logs out" a user.
/usr/lib/ruby/gems/1.8/gems/authlogic-1.3.7/lib/authlogic/session/base.rb:155
send("#{field}=", value)
(rdb:6) v l
field => "username"
value => "MYUSER"
values => {"username"=>"MYUSER", "password"=>"mypassword",
"remember_me"=>"0"}
361
362 attr_reader :#{login_field}
363
=> 364 def #{login_field}=(value)
365 self.authenticating_with = :password
366 @#{login_field} = value
367 end
368
/usr/lib/ruby/gems/1.8/gems/authlogic-1.3.7/lib/authlogic/session/base.rb:364
def #{login_field}=(value)
(rdb:6) v l
value => "MYUSER"
When the Session::Base code hits line 366 then the direct assignment of
the @params value of the login_field to the corresponding instance value
simply bypasses the setter defined in the User model, does it not?
Given this construction I cannot see a way to invoke the model's setter
method for the login field. Am I missing something?
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" 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/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---