##// END OF EJS Templates
Fixes error message for LDAP filter (#1060)....
Jean-Philippe Lang -
r9138:5663ca89facc
parent child
Show More
@@ -29,6 +29,14 class AuthSourceLdap < AuthSource
29
29
30 before_validation :strip_ldap_attributes
30 before_validation :strip_ldap_attributes
31
31
32 def self.human_attribute_name(attribute_key_name, *args)
33 attr_name = attribute_key_name.to_s
34 if attr_name == "filter"
35 attr_name = "ldap_filter"
36 end
37 super(attr_name, *args)
38 end
39
32 def initialize(attributes=nil, *args)
40 def initialize(attributes=nil, *args)
33 super
41 super
34 self.port = 389 if self.port == 0
42 self.port = 389 if self.port == 0
@@ -51,7 +51,7 class AuthSourceLdapTest < ActiveSupport::TestCase
51 a = AuthSourceLdap.new(:name => 'My LDAP', :host => 'ldap.example.net', :port => 389, :attr_login => 'sn')
51 a = AuthSourceLdap.new(:name => 'My LDAP', :host => 'ldap.example.net', :port => 389, :attr_login => 'sn')
52 a.filter = "(mail=*@redmine.org"
52 a.filter = "(mail=*@redmine.org"
53 assert !a.valid?
53 assert !a.valid?
54 assert_include "is invalid", a.errors[:filter]
54 assert_include "LDAP filter is invalid", a.errors.full_messages
55
55
56 a.filter = "(mail=*@redmine.org)"
56 a.filter = "(mail=*@redmine.org)"
57 assert a.valid?
57 assert a.valid?
General Comments 0
You need to be logged in to leave comments. Login now