Skip to content

Commit

Permalink
Merge pull request #179 from ReneB/fix-blank-password
Browse files Browse the repository at this point in the history
Fixes #20 again after huge refactor
  • Loading branch information
cschiewek committed Oct 28, 2014
2 parents a90483b + 2b2ad15 commit 8aa31ff
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/devise_ldap_authenticatable/ldap/connection.rb
Expand Up @@ -18,6 +18,8 @@ def initialize(params = {})
@ldap.port = ldap_config["port"]
@ldap.base = ldap_config["base"]
@attribute = ldap_config["attribute"]
@allow_unauthenticated_bind = ldap_config["allow_unauthenticated_bind"]

@ldap_auth_username_builder = params[:ldap_auth_username_builder]

@group_base = ldap_config["group_base"]
Expand Down Expand Up @@ -72,6 +74,7 @@ def ldap_param_value(param)
end

def authenticate!
return false unless (@password.present? || @allow_unauthenticated_bind)
@ldap.auth(dn, @password)
@ldap.bind
end
Expand Down
Expand Up @@ -3,6 +3,7 @@
# You can also just copy and paste the tree (do not include the "authorizations") to each
# environment if you need something different per enviornment.
authorizations: &AUTHORIZATIONS
allow_unauthenticated_bind: false
group_base: ou=groups,dc=test,dc=com
## Requires config.ldap_check_group_membership in devise.rb be true
# Can have multiple values, must match all to be authorized
Expand Down

0 comments on commit 8aa31ff

Please sign in to comment.