Class: SessionsController

Inherits:
Devise::SessionsController
  • Object
show all
Defined in:
app/controllers/sessions_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject


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

def create
  resource = warden.authenticate!(scope: resource_name, recall: "#{controller_path}#new")
  set_flash_message(:notice, :signed_in) if is_navigational_format?
  (resource_name, resource)
  resource.ensure_private_token!
  respond_to do |format|
    format.html { redirect_to (resource) }
    format.json { render status: '201', json: resource.as_json(only: [:login, :email, :private_token]) }
  end
end

#newObject


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

def new
  super
  cache_referrer
end

#valify_captcha!Object


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

def valify_captcha!
  set_locale
  if !verify_rucaptcha?
    redirect_to new_user_session_path, alert: t('rucaptcha.invalid') and return
  end
  true
end