On Aug 12, 11:42 pm, dusty <[email protected]> wrote: > On Aug 12, 4:02 pm, dusty <[email protected]> wrote: > > > > > I am having an issue with merb-auth and subdomains that I'd love some > > help with. > > > The problem is if I login towww.mydomain.comandthen later hit a > > page as mydomain.com, I am asked to log back in. Or, perhaps I go > > from city.mydomain.com to anothercity.mydomain.com, I am also asked to > > authenticate. > > > My goal is to allow my users to switch subdomains, without having to > > log back in. > > > I've tried setting Merb::Config[:default_cookie_domain], but that > > doesn't appear to be used in session cookies. > > > In rails, I would do something like this: > > > ActionController::CgiRequest::DEFAULT_SESSION_OPTIONS.update > > (:session_domain => '.mydomain.com') > > > Is there anything I can do with merb-auth to make this work? Or, > > should I just look at patching merb-core? > > > Thanks for any help you can provide. > > Here is an update. I am running merb-core 1.0.11. Anyway, here is a > patch that makes it work in case anyone else is interested. > > diff --git a/merb-core/lib/merb-core/dispatch/session.rb b/merb-core/ > lib/merb-core/dispatch/session.rb > index 66a8b7f..92365f7 100644 > --- a/merb-core/lib/merb-core/dispatch/session.rb > +++ b/merb-core/lib/merb-core/dispatch/session.rb > @@ -118,12 +118,15 @@ module Merb > # Keep track of all known session store types. > base.cattr_accessor :registered_session_types > base.registered_session_types = Dictionary.new > - > base.class_inheritable_accessor :_session_id_key, :_session_secret_key, > - :_session_expiry > + base.class_inheritable_accessor :_session_id_key, > + :_session_secret_key, > + :_session_expiry, > + :_default_cookie_domain > > base._session_id_key = Merb::Config[:session_id_key] > || '_session_id' > base._session_expiry = Merb::Config[:session_expiry] > || 0 > base._session_secret_key = Merb::Config > [:session_secret_key] > + base._default_cookie_domain = Merb::Config > [:default_cookie_domain] > end > > module ClassMethods > @@ -247,6 +250,7 @@ module Merb > def set_session_cookie_value(value, options = {}) > defaults = {} > defaults[:expires] = Time.now + _session_expiry if > _session_expiry > 0 > + defaults[:domain] = _default_cookie_domain if > _default_cookie_domain > cookies.set_cookie(_session_id_key, value, defaults.merge > (options)) > end > alias :set_session_id_cookie :set_session_cookie_value
Might be easier to read in an existing ticket I found, although it was marked as resolved. https://merb.lighthouseapp.com/projects/7433/tickets/482-add-domain-to-session-option --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "merb" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/merb?hl=en -~----------~----~----~----~------~----~------~--~---
