Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Session expires randomly after clicking in groups view #722

Closed
jerboaa opened this issue Mar 14, 2012 · 15 comments
Closed

Session expires randomly after clicking in groups view #722

jerboaa opened this issue Mar 14, 2012 · 15 comments
Assignees
Labels
Milestone

Comments

@jerboaa
Copy link
Member

jerboaa commented Mar 14, 2012

Steps to reproduce:

  1. Log in to sandbox.markusproject.org
  2. Go to the groups tab.
  3. Try to delete/rename a group
  4. Click on the assignments tab
  5. Session expired for some reason

Could this be a side effect of the cookie detection?

@ghost ghost assigned cy Mar 14, 2012
@jerboaa
Copy link
Member Author

jerboaa commented Mar 14, 2012

@ctcyu Could you have a look at this? Let us know if it's not cookie detection/session update related.

@jerboaa
Copy link
Member Author

jerboaa commented Mar 14, 2012

@baadshah02 Does this ring any bell for you?

@jerboaa
Copy link
Member Author

jerboaa commented Mar 14, 2012

Perhaps this is only related to a missing <%= csrf_meta_tag %>?

@baadshah02
Copy link
Contributor

@jerboaa, Not sure why it's doing it. It could be because of the <%=csrf_meta_tag%>. I think I was asked to remove it by Danesh.

@jerboaa
Copy link
Member Author

jerboaa commented Mar 14, 2012

@baadshah02 Could you test and report if the issue is gone. Thanks!

@baadshah02
Copy link
Contributor

@jerboaa it seems like there is a <%=csrf_meta_tag%> in the index page of Groups. So then it may not be because of that.

@jerboaa
Copy link
Member Author

jerboaa commented Mar 15, 2012

@baadshah02 OK, thanks! Something is fishy with respect to ajax calls we are doing. They all come back with a please-log-in response. hmm....

@hansonwu
Copy link
Contributor

@jerboaa Is the sandbox the one built off the master branch?

@baadshah02 this is after your fix for all the groups actions went in? I suspected it wouldn't work because you are doing a link_to() with a :method other than :post. I remember bringing it up in codereview.

Anyhow, in reality it "should" work if we have the up-to-date prototype-ujs support for rails, which I'm not sure we do. As it stands, looks like something is funky with our prototype-ujs that is causing these problems. I think that's where we should investigate. Not positive, but I don't think it has anything to do with cookies.
https://github.com/rails/prototype-ujs

I ran into similar problems when working on the link_to() stuff. If you try to use link_to() to do a :delete or :put, then it just returns a "302 redirect" and logs you out of the system.

@jerboaa
Copy link
Member Author

jerboaa commented Mar 17, 2012

@hansonwu Yes. sanbox is master based. Thanks for the heads-up. You are probably onto something. What's weird is that I'm pretty sure it worked for me at some point. In any case it's a high priority to get this fixed.

@jerboaa
Copy link
Member Author

jerboaa commented Mar 17, 2012

BTW. I'm not yet 100% positive that we can rule csrf-tags problems out. Would have to dig into the code a bit and I am a bit swamped at the moment.

@baadshah02
Copy link
Contributor

@hansonwu yes i think you're right. I remember you mentioned it in the code review but I might have missed this scenario at the time being. I think I did encounter this issue, but I thought it was because I let session be idle for too long. I did some digging and found that link_to() causes errors for any links other than GET. The most apt solution i found so far is to use button_to() but we can't use that in this case. @hansonwu, @jerboaa, do you have any suggestions as to what we can do to fix this?

@jerboaa
Copy link
Member Author

jerboaa commented Mar 17, 2012

@baadshah02 I'm doubtful that we'll be able to use buttons on this page. It would clutter things too much. Having said that, if there is an easy way to create an image button that could work. Something like

button_tag(:type => 'button') do
  image_tag(path-to-image)
end

might work. See[1]

Back to trying to fix link_to: What is the order of included js files on this page? See http://railsforum.com/viewtopic.php?id=38460 Have you tried putting rails.js last?

[1] http://api.rubyonrails.org/classes/ActionView/Helpers/FormTagHelper.html#method-i-button_tag

@ghost ghost assigned baadshah02 Mar 17, 2012
@baadshah02
Copy link
Contributor

@jerboaa, putting 'rails.js' last fixes it! should i put this on RB?

@jerboaa
Copy link
Member Author

jerboaa commented Mar 17, 2012

yes.

@baadshah02
Copy link
Contributor

ok it's done..thanks for the fix. sorry i didn't see this before hand though. :)

@baadshah02 baadshah02 mentioned this issue Mar 26, 2012
@reidka reidka closed this as completed Jul 28, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants