Method: Sorcery::Controller::InstanceMethods#require_login

Defined in:
lib/sorcery/controller.rb

#require_loginObject

To be used as before_action. Will trigger auto-login attempts via the call to logged_in? If all attempts to auto-login fail, the failure callback will be called.



20
21
22
23
24
25
26
27
28
# File 'lib/sorcery/controller.rb', line 20

def 
  return if logged_in?

  if Config.save_return_to_url && request.get? && !request.xhr? && !request.format.json?
    session[:return_to_url] = request.url
  end

  send(Config.not_authenticated_action)
end