Class: HubIdentityRuby::SessionsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/hub_identity_ruby/sessions_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



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

def create
  current_user = get_current_user
  if current_user.present?
    session[:current_user] = current_user
    flash[:notice] = "logged in sucessfully through HubIdentity"
    redirect_to "/"
  else
    flash[:alert] = "authentication failure"
    redirect_to "/"
  end
end

#destroyObject



22
23
24
25
26
# File 'app/controllers/hub_identity_ruby/sessions_controller.rb', line 22

def destroy
  session.destroy
  flash[:notice] = "logged out sucessfully"
  redirect_to "/"
end

#newObject



6
7
8
# File 'app/controllers/hub_identity_ruby/sessions_controller.rb', line 6

def new
  redirect_to "#{HubIdentityRuby::Server.hostname}/browser/v1/providers?api_key=#{public_key}"
end