I am trying to do an authentication where I have :
session[“User”] = User.authenticate(@params[“name”],
@params[“password”])
and the program continues on if the authentication is correct. Now if
later on in the session I want to access “User”'s data (using active
directory) I try to use:
if session[“User”].id == 0
//do something
else
//do something else
Now I always get id =0 so i must have set the session wrong or not at
all? Here is how i do the authentication:
if session[“User”] = User.authenticate(@params[“name”],
@params[“password”])
if session[“return_to”]
redirect_to_path(session[“return_to”])
session[“return_to”] = nil
else
redirect_to :controller => “NewController”
end
else
flash[:error] = ‘Invalid user name and/or password.’
redirect_to :action => “index”
end
I try to use session[“User”] elsewhere to get data but no good. Can
someone help? thanks!