views:

301

answers:

1

Hi,

I am using rails 3.0.0.beta3 to implement authlogic and subdomain-fu. And, I have a problem with automatic login into subdomain after signup.

The scenario is : I have a signup form where an account and an admin user for that account are created simultaneously. Each time a new account is created, a separate subdomain is assigned to that account.

When the form is submitted, I expect the user to be redirected to "user-sub-domain"."app-domain".com with the session for that sub-domain created automatically.

Currently, although the user is redirected to the corresponding subdomain, the session is not created. I think that the session is created only for the app-domain and when it is redirected to the subdomain, it doesn't find the session and thus, prompts the user to login again.

However, second-time login works fine.

I tried something like config.action_controller.session = { :domain => '.dummy.localhost' } in development.rb. But, it doesn't seem to work. It still shows up the login form.

I would appreciate your help.

Thanks.

+1  A: 

Look at "config/initializers/session_store.rb":

Rails.application.config.session_store :cookie_store, {
:key => 'app_session',
:domain => '.example.com' }
sebcioz