Sha256: 30bd4df3336982b28cab67c62701be12b1f8c945190cbd771b74c4b7ea766577

Contents?: true

Size: 672 Bytes

Versions: 16

Compression:

Stored size: 672 Bytes

Contents

module Spina
  module Admin
    class SessionsController < AdminController

      layout "spina/login"

      skip_before_action :authorize_spina_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] = I18n.t('spina.notifications.wrong_username_or_password')
          render "new"
        end
      end

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

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
spina-2.0.2 app/controllers/spina/admin/sessions_controller.rb
spina-2.0.1 app/controllers/spina/admin/sessions_controller.rb
spina-2.0.0 app/controllers/spina/admin/sessions_controller.rb
spina-2.0.0.beta app/controllers/spina/admin/sessions_controller.rb
spina-2.0.0.alpha app/controllers/spina/admin/sessions_controller.rb
spina-1.2.0 app/controllers/spina/admin/sessions_controller.rb
spina-1.1.4 app/controllers/spina/admin/sessions_controller.rb
spina-1.1.3 app/controllers/spina/admin/sessions_controller.rb
spina-1.1.2 app/controllers/spina/admin/sessions_controller.rb
spina-1.1.1 app/controllers/spina/admin/sessions_controller.rb
spina-1.1.0 app/controllers/spina/admin/sessions_controller.rb
spina-1.0.3 app/controllers/spina/admin/sessions_controller.rb
spina-1.0.2 app/controllers/spina/admin/sessions_controller.rb
spina-1.0.1 app/controllers/spina/admin/sessions_controller.rb
spina-1.0.0 app/controllers/spina/admin/sessions_controller.rb
spina-0.12.0 app/controllers/spina/admin/sessions_controller.rb