Class: ShopappLoginController

Inherits:
ApplicationController
  • Object
show all
Includes:
ShopliftClient
Defined in:
app/controllers/shopapp_login_controller.rb

Instance Method Summary collapse

Methods included from ShopliftClient

#authenticate_company!, #authenticate_user, #authenticate_user!, #authenticate_user_or_api!, #client, #company_info, #company_logo_path_defined, #current_auditor, #current_company, #current_user, #current_user_json, #find_company_by_code, #get, #handle_not_authorized, #hide_search_for_this_action, #home_link_path, #local_authlift_redirect_uri, #post, #redirect_unauthorized, #scope, #search_remote, #session_cookie, #session_cookie=, #shoplift_login_url, #show_search_for_this_action, #srv, #supported_locales_defined, #user_signed_in?

Methods included from Shopapp3

#sidebar_actions_list

Instance Method Details

#welcomeObject



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'app/controllers/shopapp_login_controller.rb', line 4

def welcome
  redirect_parameters = { return_path: request.url }

  if params['set_i18n_pub']
    cookies[:set_i18n_pub] = params['set_i18n_pub']
  end

  I18n.locale = if cookies[:set_i18n_pub].present?
    redirect_parameters[:set_i18n_pub] = cookies[:set_i18n_pub]
    cookies[:set_i18n_pub].to_sym
  else
    I18n.default_locale
  end

  unless Rails.configuration.settings['use_welcome_screen'].present?
    redirect_to root_path
    return
  end

  if authenticate_user
    redirect_to root_path
  else
    if params['logged_in'] == 'false'
      render 'shopapp/login_message', layout: nil
    elsif params['logged_in'] == 'true'
      authenticate_user! true
    else
      destination = URI("#{Rails.configuration.settings['authlift_url']}softly_verify_login")
      destination.query = redirect_parameters.to_query
      redirect_to destination.to_s
    end
  end
end