lundi 7 décembre 2015

Authenticate with http_basic_authenticate_with Error?

I am using a gem called Administrate with the http_basic_authenticate_with and it's working fine except when i want to set the username for the Admin. When i specify the name and the password, i still get a message "Not Authorized" althought its the right username and password that i set in the Application Controlelr .

class Admin::ApplicationController < Administrate::ApplicationController

  http_basic_authenticate_with name: "myname", password: "secretpassword"


  before_action :authenticate_user!
  before_action :authenticate_admin


  def authenticate_admin
    redirect_to '/', alert: 'Not authorized.' unless current_user && access_whitelist 
  end

  private
    def access_whitelist
      current_user.try(:admin?) || current_user.try(:door_super?)
    end

end

Did anyone had this issue before ??

Aucun commentaire:

Enregistrer un commentaire