Module: Adva::AuthenticateUser::ClassMethods
- Defined in:
- lib/adva/authenticate_user.rb
Overview
Methods available as macro-style methods on any controller
Instance Method Summary collapse
-
#authentication_required ⇒ Object
Sets up the controller so that authentication is required.
-
#no_authentication_required ⇒ Object
Will remove authentication from certain actions.
Instance Method Details
#authentication_required ⇒ Object
Sets up the controller so that authentication is required. If the user is not authenticated then they will be redirected to the login screen.
The page requested will be saved so that once the login has occured they will be sent back to the page they first requested. If no page was requested (they went to the login page directly) then they will be directed to profiles/home after login which is a placeholder for the app to override.
Options given are passed directly to the before_action method so feel free to provide :only and :except options.
22 23 24 |
# File 'lib/adva/authenticate_user.rb', line 22 def authentication_required before_action :require_authentication end |
#no_authentication_required ⇒ Object
Will remove authentication from certain actions. Options given are passed directly to skip_before_action so feel free to use :only and :except options.
This method is useful in cases where you have locked down the entire application by putting authentication_required in your ApplicationController but then want to open an action back up in a specific controller.
34 35 36 |
# File 'lib/adva/authenticate_user.rb', line 34 def no_authentication_required skip_before_action :require_authentication end |