Class: Spina::Admin::SessionsController
- Inherits:
-
AdminController
- Object
- ActionController::Base
- Spina::ApplicationController
- AdminController
- Spina::Admin::SessionsController
- Defined in:
- app/controllers/spina/admin/sessions_controller.rb
Instance Method Summary collapse
Methods inherited from AdminController
Instance Method Details
#create ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 |
# File 'app/controllers/spina/admin/sessions_controller.rb', line 12 def create user = User.where(email: params[:email]).first if user && user.authenticate(params[:password]) session[:user_id] = user.id user.update_last_logged_in! redirect_to spina.admin_root_url else flash.now[:alert] = I18n.t('spina.notifications.wrong_username_or_password') render "new" end end |
#destroy ⇒ Object
24 25 26 27 |
# File 'app/controllers/spina/admin/sessions_controller.rb', line 24 def destroy session[:user_id] = nil redirect_to "/" end |
#new ⇒ Object
9 10 |
# File 'app/controllers/spina/admin/sessions_controller.rb', line 9 def new end |