3

我正在创建一个应用程序,我试图将 LDAP 与 authlogic 一起用于登录身份验证。如果用户在 LDAP 服务器上,我只想接受用户名并登录。为此,我需要禁用密码验证。我怎样才能做到这一点?

4

4 回答 4

2

我认为你可以这样做:

class User < ActiveRecord::Base
  acts_as_authentic do |config|
    config.validate_password_field = false
  end
end
于 2010-04-03T23:29:33.303 回答
1

我为我的应用程序修改的 authlogic_ldap 插件有同样的问题。我犯了包含login_field :ldap_login在 User 类中的错误。我最初也有一个stack level too deep错误,但我将 authlogic 从 v3.0.3 恢复到 v3.0.2,它现在可以工作了。

于 2011-07-26T10:37:09.260 回答
1

在您调用acts_as_authentic的用户模型中,这可能会奏效:

acts_as_authentic do |config|
  config.require_password_confirmation = false
  config.ignore_blank_passwords = true
end

这些配置选项可以在 lib/authlogic/acts_as_authentic/password.rb 中找到(在 2.1.3 版中)。

于 2010-01-26T07:19:28.450 回答
0

users通过在表中没有密码列并将此配置用于 Authlogic ,我成功地使用 Open ID(相同的想法,我的应用程序未存储密码)执行此操作:

class User < ActiveRecord::Base
  acts_as_authentic do |c|
    c.crypted_password_field = false
  end
end

如果没有设置crypted_password_field,用户保存时会产生错误。

于 2010-01-03T19:01:30.040 回答