Class: Clearance::SessionsController
- Inherits:
-
BaseController
- Object
- ApplicationController
- BaseController
- Clearance::SessionsController
- Defined in:
- app/controllers/clearance/sessions_controller.rb
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
- #new ⇒ Object
- #redirect_signed_in_users ⇒ Object private
- #url_after_create ⇒ Object private
- #url_after_destroy ⇒ Object private
- #url_for_signed_in_users ⇒ Object private
Instance Method Details
#create ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'app/controllers/clearance/sessions_controller.rb', line 5 def create @user = authenticate(params) sign_in(@user) do |status| if status.success? redirect_back_or url_after_create else flash.now.alert = status. render template: "sessions/new", status: :unauthorized end end end |
#destroy ⇒ Object
18 19 20 21 |
# File 'app/controllers/clearance/sessions_controller.rb', line 18 def destroy sign_out redirect_to url_after_destroy, status: :see_other end |
#new ⇒ Object
23 24 25 |
# File 'app/controllers/clearance/sessions_controller.rb', line 23 def new render template: "sessions/new" end |
#redirect_signed_in_users ⇒ Object (private)
29 30 31 32 33 |
# File 'app/controllers/clearance/sessions_controller.rb', line 29 def redirect_signed_in_users if signed_in? redirect_to url_for_signed_in_users end end |
#url_after_create ⇒ Object (private)
35 36 37 |
# File 'app/controllers/clearance/sessions_controller.rb', line 35 def url_after_create Clearance.configuration.redirect_url end |
#url_after_destroy ⇒ Object (private)
39 40 41 |
# File 'app/controllers/clearance/sessions_controller.rb', line 39 def url_after_destroy Clearance.configuration.url_after_destroy || sign_in_url end |
#url_for_signed_in_users ⇒ Object (private)
43 44 45 |
# File 'app/controllers/clearance/sessions_controller.rb', line 43 def url_for_signed_in_users url_after_create end |