Sha256: caf5a56132c21f1061cd4799ac551c9ce8a455788454be5818df1091efb9620f

Contents?: true

Size: 650 Bytes

Versions: 2

Compression:

Stored size: 650 Bytes

Contents

module Spina
  module Admin
    class SessionsController < AdminController
      
      layout "spina/login"

      skip_before_filter :authorize_user

      def new
      end

      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] = "Email of wachtwoord is onjuist"
          render "new"
        end
      end

      def destroy
        session[:user_id] = nil
        redirect_to "/"
      end
    end  
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
spina-0.6.12 app/controllers/spina/admin/sessions_controller.rb
spina-0.6.11 app/controllers/spina/admin/sessions_controller.rb