Sha256: 2870726695386e834fccdc2752f52b992bb08ff2a7fa0d740750677eea13977d

Contents?: true

Size: 591 Bytes

Versions: 2

Compression:

Stored size: 591 Bytes

Contents

class Admin::SessionsController < Admin::BaseController
  skip_before_action :authenticate, only: %i[ new create ]

  layout "admin/authentication"

  def new
    @user = Admin::User.new
  end

  def create
    if user = Admin::User.authenticate_by(email: params[:email], password: params[:password])
      session[:admin_user_id] = user.id; redirect_to(admin_path)
    else
      redirect_to admin_sign_in_path(email_hint: params[:email]), alert: "That email or password is incorrect"
    end
  end

  def destroy
    session[:admin_user_id] = nil; redirect_to admin_sign_in_path
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
administration-zero-1.0.6 lib/generators/admin/install/templates/controllers/admin/sessions_controller.rb
administration-zero-1.0.5 lib/generators/admin/install/templates/controllers/admin/sessions_controller.rb