Sha256: 1362ed0a570cb87e8946afa726feb56db4d77cc01d54d7418a199b3420811872

Contents?: true

Size: 941 Bytes

Versions: 6

Compression:

Stored size: 941 Bytes

Contents

module Admin
  class CrossDomainSessionsController < BaseController

    layout 'admin/box'

    skip_before_filter :verify_authenticity_token

    skip_before_filter :validate_site_membership

    skip_before_filter :set_locale, :only => :create

    before_filter :authenticate_admin!, :only => :new

    def new
      if site = current_admin.sites.detect { |s| s._id.to_s == params[:target_id] }
        @target = site.domains_without_subdomain.first || site.domains_with_subdomain.first
        current_admin.reset_switch_site_token!
      else
        redirect_to admin_pages_path
      end
    end

    def create
      if account = Account.find_using_switch_site_token(params[:token])
        account.reset_switch_site_token!
        sign_in(account)
        redirect_to admin_pages_path
      else
        redirect_to new_admin_session_path, :alert => t('flash.admin.cross_domain_sessions.create.alert')
      end
    end

  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
locomotive_cms-0.0.4.beta5 app/controllers/admin/cross_domain_sessions_controller.rb
locomotive_cms-0.0.4.beta4 app/controllers/admin/cross_domain_sessions_controller.rb
locomotive_cms-0.0.4.beta3 app/controllers/admin/cross_domain_sessions_controller.rb
locomotive_cms-0.0.4.beta2 app/controllers/admin/cross_domain_sessions_controller.rb
locomotive_cms-0.0.4.beta1 app/controllers/admin/cross_domain_sessions_controller.rb
locomotive_cms-0.0.4 app/controllers/admin/cross_domain_sessions_controller.rb