Class: Authenticate::SessionsController
- Inherits:
-
AuthenticateController
- Object
- ApplicationController
- AuthenticateController
- Authenticate::SessionsController
- Defined in:
- app/controllers/authenticate/sessions_controller.rb
Overview
Allow authenticate users to log in and log out.
Instance Method Summary collapse
-
#create ⇒ Object
Log the user in, with the provided name and password.
-
#destroy ⇒ Object
Log the user out.
-
#new ⇒ Object
Render the login screen.
Instance Method Details
#create ⇒ Object
Log the user in, with the provided name and password.
19 20 21 22 23 24 25 26 27 28 29 |
# File 'app/controllers/authenticate/sessions_controller.rb', line 19 def create @user = authenticate(params) login(@user) do |status| if status.success? redirect_back_or url_after_create else flash.now.notice = status. render template: 'sessions/new', status: :unauthorized end end end |
#destroy ⇒ Object
Log the user out
34 35 36 37 |
# File 'app/controllers/authenticate/sessions_controller.rb', line 34 def destroy logout redirect_to url_after_destroy end |
#new ⇒ Object
Render the login screen.
12 13 14 |
# File 'app/controllers/authenticate/sessions_controller.rb', line 12 def new render template: 'sessions/new' end |