Sha256: 802d5f40b43df8df8293d038a6aebe856cafb74309062f315258630af1af53ea

Contents?: true

Size: 646 Bytes

Versions: 9

Compression:

Stored size: 646 Bytes

Contents

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

  layout "admin/authentication"

  def new
    @admin_user = AdminUser.new
  end

  def create
    @admin_user = AdminUser.find_by(email: params[:email])

    if @admin_user && @admin_user.authenticate(params[:password])
      session[:admin_user_id] = @admin_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

9 entries across 9 versions & 1 rubygems

Version Path
administration-zero-0.0.9 lib/generators/admin/install/templates/controllers/admin/sessions_controller.rb
administration-zero-0.0.8 lib/generators/admin/install/templates/controllers/admin/sessions_controller.rb
administration-zero-0.0.7 lib/generators/admin/install/templates/controllers/admin/sessions_controller.rb
administration-zero-0.0.6 lib/generators/admin/install/templates/controllers/admin/sessions_controller.rb
administration-zero-0.0.5 lib/generators/admin/install/templates/controllers/admin/sessions_controller.rb
administration-zero-0.0.4 lib/generators/admin/install/templates/controllers/admin/sessions_controller.rb
administration-zero-0.0.3 lib/generators/admin/install/templates/controllers/admin/sessions_controller.rb
administration-zero-0.0.2 lib/generators/admin/install/templates/controllers/admin/sessions_controller.rb
administration-zero-0.0.1 lib/generators/admin/install/templates/controllers/admin/sessions_controller.rb