Hi, I''ve got an issue with session variables being lost in internet explorer. I have build a login system using the example used in Athentication (http://wiki.rubyonrails.com/rails/pages/Authentication) in the rubyonrails wki. It works fine in Firefox but in IE my session variable is lost. If I check the value of @session["user"] after it is set in the login controller it has a value but in the next page the variable is empty Am i doing something wrong? Thanks Nick my code is as follows: login_controller.rb def authenticate if details = User.authenticate(@params[:login]["username"], @params[:login]["password"]) @session["user"] = details if @session["user"]["user_level"] == 1 redirect_to :controller => ''apps'', :action => ''list'' else redirect_to :controller => ''bugs'', :action => ''list'' end else flash["notice"] = "Login failed" redirect_to :action => ''index'' end end bug_controller.rb before_filter :authenticate def index # stuff end protected def authenticate unless @session["user"] redirect_to :controller => ''login'' return false end end _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
I''ve managed to fix this now. The problem was to do with the domain name containing an underscore ''_''. An IE bug? Nick Linnell wrote: Hi, I''ve got an issue with session variables being lost in internet explorer. I have build a login system using the example used in Athentication (http://wiki.rubyonrails.com/rails/pages/Authentication) in the rubyonrails wki. It works fine in Firefox but in IE my session variable is lost. If I check the value of @session["user"] after it is set in the login controller it has a value but in the next page the variable is empty Am i doing something wrong? Thanks Nick my code is as follows: login_controller.rb def authenticate if details = User.authenticate(@params[:login]["username"], @params[:login]["password"]) @session["user"] = details if @session["user"]["user_level"] == 1 redirect_to :controller => ''apps'', :action => ''list'' else redirect_to :controller => ''bugs'', :action => ''list'' end else flash["notice"] = "Login failed" redirect_to :action => ''index'' end end bug_controller.rb before_filter :authenticate def index # stuff end protected def authenticate unless @session["user"] redirect_to :controller => ''login'' return false end end _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails -- Nick Linnell Kyanmedia Ltd 01483 548282 http://kyanmedia.com _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
On 10/27/05, Nick Linnell <nick-b8+U6n9zZ6uB+jHODAdFcQ@public.gmane.org> wrote:> I''ve managed to fix this now. The problem was to do with the domain name > containing an underscore ''_''. > An IE bug? > >I saw that somewhere, and yes, it seems to be an ie bug.