这张图片出了什么问题:我想在我的应用程序中添加多个登录信息 - 非常简单的http auth ...这在本地工作但只允许我以user1 / pass1登录一旦我将其上传到Heroku ...如果我尝试使用user2 / pass2,它就不会让我登录。
有什么想法吗?
class ApplicationController < ActionController::Base
helper :all
protect_from_forgery
USER_NAME, PASSWORD = "user1", "pass1"
USER_NAME2, PASSWORD2 = "user2", "pass2"
before_filter :authenticate
private
def authenticate
authenticate_or_request_with_http_basic do |user_name, password|
(user_name == USER_NAME && password == PASSWORD) || (user_name == USER_NAME2 && password == PASSWORD2)
end
end
end
谢谢!