Ruby on Rails Tuesday, January 4, 2011

I have used restful_authentication to implement a login system and it
works fine except that every couple of weeks I can't login when I use
IE; it works fine when I use other browsers! The problem goes away after
a few hours! It seems to me somehow sometimes after logging in, the
session variable is not set!

I have the following code for create action in my sessions_controller.rb

def create
logout_keeping_session!
user = User.authenticate(params[:login], params[:password])

if user
self.current_user = user
new_cookie_flag = (params[:remember_me] == "1")
handle_remember_cookie! new_cookie_flag

redirect_to '/sessions/home'
else
note_failed_signin
@login = params[:login]
@remember_me = params[:remember_me]

redirect_to "/sessions/login"
end
end

Can redirect_to '/sessions/home' cause the problem with the session
variable and erase its value?

--
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