Class: Manifest::SessionsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Manifest::SessionsController
- Defined in:
- app/controllers/manifest/sessions_controller.rb
Overview
Creates or destroys Editor sessions.
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 |
# File 'app/controllers/manifest/sessions_controller.rb', line 8 def create editor = Editor.find_by_email(params[:email]) if editor && editor.authenticate(params[:password]) session[:editor_id] = editor.id redirect_to manifest_path, notice: 'Logged in!' else flash.now.alert = 'Email or password is invalid' render 'new' end end |
#destroy ⇒ Object
20 21 22 23 |
# File 'app/controllers/manifest/sessions_controller.rb', line 20 def destroy session[:editor_id] = nil redirect_to new_manifest_session_path end |
#new ⇒ Object
5 6 |
# File 'app/controllers/manifest/sessions_controller.rb', line 5 def new end |