Class: Omniauth::Rails::SessionsController

Inherits:
ApplicationController show all
Includes:
ApplicationHelper, Flash
Defined in:
app/controllers/omniauth/rails/sessions_controller.rb

Instance Method Summary collapse

Methods included from Flash

#set_url_to_return_to_after_authentication

Methods included from ApplicationHelper

#authenticated_email, #authentication_session

Instance Method Details

#createObject

GET /:provider/callback



34
35
36
37
38
# File 'app/controllers/omniauth/rails/sessions_controller.rb', line 34

def create
  persist_authentication_data
  redirect_to flash[:url_to_return_to_after_authentication] ||
              default_url_to_return_to_after_authentication
end

#destroyObject

DELETE /sign_out



23
24
25
26
27
28
29
30
31
# File 'app/controllers/omniauth/rails/sessions_controller.rb', line 23

def destroy
  authentication_session.reset

  if Configuration.unauthenticated_root.present?
    redirect_to Configuration.unauthenticated_root
  else
    render layout: false
  end
end

#newObject

GET /sign_in



9
10
11
12
13
14
15
16
17
18
19
20
# File 'app/controllers/omniauth/rails/sessions_controller.rb', line 9

def new
  # Set a flash variable, so we know where to go after a successful authentication.
  set_url_to_return_to_after_authentication

  # If we are already authenticated, do not attempt to authenticate again.
  # Instead, redirect to where we would go after authentication
  if authenticated?
    redirect_to flash[:url_to_return_to_after_authentication]
  else
    redirect_to omniauth_route
  end
end