Sha256: b642f20971e0faabed7af04bb9d7d4beb162dad7ba8b601d541510fff3983696

Contents?: true

Size: 668 Bytes

Versions: 1

Compression:

Stored size: 668 Bytes

Contents

# I get a circular dependency error is I nest below in a Pwb module
class Pwb::Devise::OmniauthCallbacksController < Devise::OmniauthCallbacksController
  def facebook
    # https://github.com/plataformatec/devise/wiki/How-To:-OmniAuth-inside-localized-scope
    # Use the session locale set earlier; use the default if it isn't available.
    I18n.locale = session[:omniauth_login_locale] || I18n.default_locale

    @user = Pwb::User.find_for_oauth(request.env['omniauth.auth'])
    if @user.persisted?
      sign_in_and_redirect @user, event: :authentication
      set_flash_message(:notice, :success, kind: 'Facebook') if is_navigational_format?
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pwb-1.4.0 app/controllers/pwb/devise/omniauth_callbacks_controller.rb