Application will not authenticate [sends alert of invalid credentials].
Using user credentials created via rake db:seed. How do I get it to
authenticate?
Agent Model
----------------
def Agent.authenticate(name,password)
if agent = find_by_name(name)
if agent.hash == encrypt_password(password,agent.salt)
agent
end
end
end
SessionController
----------------------
def create
if agent = Agent.authenticate(params[:name],params[:password])
session[:agent_id] = agent.id
redirect_to base_url
else
redirect_to login_url,:alert=>"Invalid credentials"
end
end
Attachments:
http://www.ruby-forum.com/attachment/7352/agent.rb
http://www.ruby-forum.com/attachment/7353/application_controller.rb
http://www.ruby-forum.com/attachment/7354/sessions_controller.rb
--
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 rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
No comments:
Post a Comment