Class: Plotline::SessionsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- Plotline::SessionsController
- Defined in:
- app/controllers/plotline/sessions_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'app/controllers/plotline/sessions_controller.rb', line 12 def create user = User.find_by_email(params[:email]) if user && user.authenticate(params[:password]) .permanent[:auth_token] = user.auth_token flash[:notice] = "Hello!" redirect_to root_url else flash.now.alert = "Invalid email and/or password" render "new" end end |
#destroy ⇒ Object
25 26 27 28 |
# File 'app/controllers/plotline/sessions_controller.rb', line 25 def destroy .delete(:auth_token) redirect_to root_url end |
#new ⇒ Object
9 10 |
# File 'app/controllers/plotline/sessions_controller.rb', line 9 def new end |