Class: Kingsman::SessionsController

Inherits:
KingsmanController show all
Defined in:
app/controllers/kingsman/sessions_controller.rb

Instance Method Summary collapse

Methods inherited from KingsmanController

#build_resource

Instance Method Details

#create {|resource| ... } ⇒ Object

POST /resource/sign_in

Yields:

  • (resource)


16
17
18
19
20
21
22
# File 'app/controllers/kingsman/sessions_controller.rb', line 16

def create
  self.resource = warden.authenticate!(auth_options)
  set_flash_message!(:notice, :signed_in)
  (resource_name, resource)
  yield resource if block_given?
  respond_with resource, location: (resource)
end

#destroyObject

DELETE /resource/sign_out



25
26
27
28
29
30
# File 'app/controllers/kingsman/sessions_controller.rb', line 25

def destroy
  signed_out = (Kingsman.sign_out_all_scopes ? sign_out : sign_out(resource_name))
  set_flash_message! :notice, :signed_out if signed_out
  yield if block_given?
  respond_to_on_destroy
end

#new {|resource| ... } ⇒ Object

GET /resource/sign_in

Yields:

  • (resource)


8
9
10
11
12
13
# File 'app/controllers/kingsman/sessions_controller.rb', line 8

def new
  self.resource = resource_class.new()
  clean_up_passwords(resource)
  yield resource if block_given?
  respond_with(resource, serialize_options(resource))
end