1
我試圖在我的Rails應用中將我的自定義簡單身份驗證系統轉換爲使用身份驗證邏輯。我設法使所有的工作都相當容易,但現在當我嘗試登錄時,它不會正確驗證我的憑據。相關代碼如下:將自定義身份驗證轉換爲身份驗證邏輯
# app/models/profile.rb
class Profile < ActiveRecord::Base
acts_as_authentic do |c|
c.transition_from_crypto_providers = Authlogic::CryptoProviders::Sha1,
c.crypto_provider = Authlogic::CryptoProviders::Sha512
end
end
我曾經用這個來創建散列我的密碼:
# app/models/profile.rb
def hash_password
self.salt = ActiveSupport::SecureRandom.base64(8)
self.hashed_password = Digest:SHA1.hexdigest(self.salt + @password)
end
我已經轉換所需的所有表列與AuthLogic兼容。 有沒有辦法記錄AuthLogic將密碼散列爲?還有什麼可能是錯的?