Topic: Authentication
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
Last edited by xan8@live.com (2012-05-01 08:57:36)