2011-11-02 48 views
0

這張圖有什麼問題:我想添加多個登錄到我的應用 - 真正簡單的http auth ...這是在本地工作,但只允許我以user1/pass1身份登錄一次'已上傳到Heroku ...如果我嘗試user2/pass2,它不會讓我登錄。http auth rails 3.0.9

任何想法?

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 

謝謝!

回答

1

我已經嘗試使用與您具有相同的代碼。我做了一個heroku app,並做出了和你一樣的常數。但是使用任何一個密碼都沒有遇到任何問題。你能提供關於你應用的更多細節嗎?