Sha256: d86d37e7fe1eabc84c4d7de41d02b9fb759f0c31e7867a40fbc4f71635779f4f

Contents?: true

Size: 679 Bytes

Versions: 20

Compression:

Stored size: 679 Bytes

Contents

module Spina
  module Admin
    class SessionsController < AdminController
      skip_before_action :authenticate

      def new
      end

      def create
        user = User.where(email: params[:email]).first
        if user && user.authenticate(params[:password])
          session[:spina_user_id] = user.id
          user.touch(:last_logged_in)
          redirect_to spina.admin_root_url
        else
          flash.now[:alert] = I18n.t('spina.notifications.wrong_username_or_password')
          render "new", status: :unprocessable_entity
        end
      end

      def destroy
        session.delete(:spina_user_id)
        redirect_to "/"
      end
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
spina-2.12.0 app/controllers/spina/admin/sessions_controller.rb
spina-2.11.0 app/controllers/spina/admin/sessions_controller.rb
spina-2.10.0 app/controllers/spina/admin/sessions_controller.rb
spina-2.9.1 app/controllers/spina/admin/sessions_controller.rb
spina-2.9.0 app/controllers/spina/admin/sessions_controller.rb
spina-2.8.1 app/controllers/spina/admin/sessions_controller.rb
spina-2.8.0 app/controllers/spina/admin/sessions_controller.rb
spina-2.7.0 app/controllers/spina/admin/sessions_controller.rb
spina-2.6.2 app/controllers/spina/admin/sessions_controller.rb
spina-2.6.1 app/controllers/spina/admin/sessions_controller.rb
spina-2.6.0 app/controllers/spina/admin/sessions_controller.rb
spina-2.5.0 app/controllers/spina/admin/sessions_controller.rb
spina-2.4.0 app/controllers/spina/admin/sessions_controller.rb
spina-2.3.5 app/controllers/spina/admin/sessions_controller.rb
spina-2.3.4 app/controllers/spina/admin/sessions_controller.rb
spina-2.3.3 app/controllers/spina/admin/sessions_controller.rb
spina-2.3.2 app/controllers/spina/admin/sessions_controller.rb
spina-2.3.1 app/controllers/spina/admin/sessions_controller.rb
spina-2.3.0 app/controllers/spina/admin/sessions_controller.rb
spina-2.2.0 app/controllers/spina/admin/sessions_controller.rb