Class: AuthicClient::SessionsController

Inherits:
ActionController::Base
  • Object
show all
Defined in:
app/controllers/authic_client/sessions_controller.rb

Direct Known Subclasses

Authic::SessionsController

Instance Method Summary collapse

Instance Method Details

#createObject



2
3
4
5
6
7
8
9
10
11
12
13
# File 'app/controllers/authic_client/sessions_controller.rb', line 2

def create
  user = User.find_for_authic_oauth(request.env["omniauth.auth"], current_user)
  if user.persisted?
    session[:authic_user_id] = user.id
    redirect_path ||= session[:authic_return_to_this_url] ||= root_url
    # make sure the return to session variable is nil so it cant accidently get re-used
    session[:authic_return_to_this_url] = nil
    redirect_to redirect_path, :notice => "You have been successfully signed in"
  else
    redirect_to root_url
  end
end

#destroyObject



15
16
17
18
19
# File 'app/controllers/authic_client/sessions_controller.rb', line 15

def destroy
  reset_session
  redirect_path = "#{AuthicClient::ApplicationHelper::AUTHIC_CLIENT_FULL_URL}/authic_sign_out?&return_path=#{URI.escape root_url}"
  redirect_to redirect_path
end