Sha256: 867ef10d4808230d96483d4385e7e7438030f988a7c0303a233df56e34ed6356

Contents?: true

Size: 1.11 KB

Versions: 10

Compression:

Stored size: 1.11 KB

Contents

class AuthController < ActionController::Base
  include ShopliftClient
  protect_from_forgery with: :exception

  def auth
    response = client.auth_code.get_token params[:code],
                                          redirect_uri: Rails.configuration.settings['authlift_redirect_uri'],
                                          scope: scope
    self.session_cookie = response.token
    previous_url = session[:previous_url]
    session.delete :previous_url
    redirect_to(previous_url || '/')
  end

  def destroy
    authenticate_user!
    return if current_user.blank?
    signouttoken = session_cookie
    session_cookie = nil

    redirect_to "#{Rails.configuration.settings['authlift_url']}users/sign_outx?signouttoken=#{signouttoken}"
  end

  def change_company
    authenticate_user!
    return if current_user.blank?
    new_company_code = params.except(:_method, :authenticity_token).permit(:new_company_code)[:new_company_code]

    signouttoken = session_cookie
    redirect_to "#{Rails.configuration.settings['authlift_url']}users/change_companyx/#{new_company_code}?change_company_token=#{signouttoken}"
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
shopapp-0.2.01 app/controllers/auth_controller.rb
shopapp-0.1.36 app/controllers/auth_controller.rb
shopapp-0.1.35 app/controllers/auth_controller.rb
shopapp-0.1.34 app/controllers/auth_controller.rb
shopapp-0.1.33 app/controllers/auth_controller.rb
shopapp-0.1.32 app/controllers/auth_controller.rb
shopapp-0.1.31 app/controllers/auth_controller.rb
shopapp-0.1.29 app/controllers/auth_controller.rb
shopapp-0.0.16 app/controllers/auth_controller.rb
shopapp-0.0.15 app/controllers/auth_controller.rb