Class: V2Users::OmniauthController

Inherits:
ApplicationV2Controller show all
Defined in:
app/controllers/v2_users/omniauth_controller.rb

Instance Method Summary collapse

Methods inherited from ApplicationV2Controller

#identity_cache_memoization

Methods included from LogrageCustomLogger

#append_info_to_payload

Instance Method Details

#localizedObject



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'app/controllers/v2_users/omniauth_controller.rb', line 4

def localized
  # Just save the current locale in the session and redirect to the unscoped path as before
  locale = params.fetch(:locale, MyLocaleManager.normalize_locale)
  session[:omniauth_login_locale] = locale

  promo_code = params.fetch(:promo_code, nil)
  cookies[:signup_code_campaign] = { value: promo_code, expires: 1.hour.from_now } if promo_code
  guest_booking_ids = params.key?(:guest_booking_ids) && params[:guest_booking_ids]
  cookies[:guest_booking_ids] = { value: guest_booking_ids, expires: 1.hour.from_now } if guest_booking_ids
  case params[:provider].to_s
  when 'facebook'
    redirect_to user_facebook_omniauth_authorize_path(locale: locale)
  when 'google'
    redirect_to user_user_google_oauth2_omniauth_authorize_path(locale: locale)
  else
    HH_LOGGER.info('unknown omniauth provider', params: params)
    render plain: 'Wordpress Admin Dashboard'
  end
end