سؤال

I am setting the user to redirect to a subdomain based on a nested form parameter after signup. However, when I do the redirect, the user is not logged in. I can go back in and manually log the user in, and I can verify the user is created, it just appears the session isn't immediately created after registration.

Here's the method I'm using to redirect the user (in registrations_controller.rb):

  def after_sign_up_path_for(resource_or_scope)
    root_url(subdomain: params[:user][:organizations_attributes]["0"][:subdomain])
  end

The routing to the subdomain works fine, btw.

I think this is a problem with sharing sessions across subdomain, as I am logged in when I remove the subdomain from the url and refresh.

I've tried add this this to my app/config/initializers/session_store.rb file:

Vocalem::Application.config.session_store :cookie_store, key: '_vocalem_session', :domain => :all
هل كانت مفيدة؟

المحلول

Turns out I just needed to reboot my server!

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top