Hi We have a rails application deployed and working fine. Along with this, we are planning to add "Opinion" forum. The url of the forum will be like http://forum.mymainsite.com Is it possible to share the session (that is, if the user is already logged in on the main site, he need not log in again on the forum section). Is it possible to add the ''opinion'' as a child of the rails website, to keep the session. thanks =R _________________________________________________________________ Add photos, news, and blogs about the World Cup to your Live.com homepage! http://www.live.com/getstarted -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060703/95c7cf05/attachment.html
On 7/2/06, Rajesh GS <sabkaraja@hotmail.com> wrote:> > Hi > > We have a rails application deployed and working fine. Along with this, we > are planning to add "Opinion" forum. The url of the forum will be like > http://forum.mymainsite.com Is it possible to share the session (that is, if > the user is already logged in on the main site, he need not log in again on > the forum section). > > Is it possible to add the ''opinion'' as a child of the rails website, to > keep the session.I''m not sure how rails sets cookies. If it sets them for the whole domain, and your forum runs on the same domain and sets cookies domain wide also, then you should be able to share the cookie. As for the session data it would probably work to share that, but of course your forum would have to read/write to it in the correct format. It would probably be easier to do it another way though. For example have a secret that your rails app and the forum both know, and when linking to the forum put the hashed secret in the query string and have that signify that the user is logged in. Or create an action in your rails app that verifies if a user is logged in, and have your forum do an http post to the verification url. Both of those are probably easier then trying to share the session data. Chris
On Jul 2, 2006, at 10:48 PM, snacktime wrote:> On 7/2/06, Rajesh GS <sabkaraja@hotmail.com> wrote: >> >> Hi >> >> We have a rails application deployed and working fine. Along with >> this, we >> are planning to add "Opinion" forum. The url of the forum will be >> like >> http://forum.mymainsite.com Is it possible to share the session >> (that is, if >> the user is already logged in on the main site, he need not log in >> again on >> the forum section). >> >> Is it possible to add the ''opinion'' as a child of the rails >> website, to >> keep the session. > > I''m not sure how rails sets cookies. If it sets them for the whole > domain, and your forum runs on the same domain and sets cookies domain > wide also, then you should be able to share the cookie. As for the > session data it would probably work to share that, but of course your > forum would have to read/write to it in the correct format. > > It would probably be easier to do it another way though. For example > have a secret that your rails app and the forum both know, and when > linking to the forum put the hashed secret in the query string and > have that signify that the user is logged in. Or create an action in > your rails app that verifies if a user is logged in, and have your > forum do an http post to the verification url. Both of those are > probably easier then trying to share the session data. > > ChrisRajesh- Set this in your config/environments/production.rb ActionController::CgiRequest::DEFAULT_SESSION_OPTIONS.update ( :session_domain => ''.mymainsite.com'') -Ezra
Ezra Zygmuntowicz wrote:> On Jul 2, 2006, at 10:48 PM, snacktime wrote: > >>> the user is already logged in on the main site, he need not log in >> session data it would probably work to share that, but of course your >> Chris > Rajesh- > > Set this in your config/environments/production.rb > > ActionController::CgiRequest::DEFAULT_SESSION_OPTIONS.update > ( :session_domain => ''.mymainsite.com'') > > -EzraI''d like to do what Rajesh was trying to do. The MySQL session store uses the session_id column as the key for the session data. Does Rails use the same session_id on both the main site and the forum site to access the MySQL session store? Thanks. -- 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---