Commit 873f1d46d2dc8e0da70e66d6cd57341a31b4b285
1 parent
f6703513
Exists in
master
and in
29 other branches
[ldap plugin] Updated readme
Also changed method used to guess encoding
Showing
2 changed files
with
2 additions
and
1 deletions
Show diff stats
plugins/ldap/README.md
@@ -13,6 +13,7 @@ Dependences | @@ -13,6 +13,7 @@ Dependences | ||
13 | See the Noosfero install file. After install Noosfero, install LDAP dependences: | 13 | See the Noosfero install file. After install Noosfero, install LDAP dependences: |
14 | 14 | ||
15 | $ gem install net-ldap -v 0.3.1 | 15 | $ gem install net-ldap -v 0.3.1 |
16 | +$ sudo apt-get install ruby-magic | ||
16 | 17 | ||
17 | Enable Plugin | 18 | Enable Plugin |
18 | ------------- | 19 | ------------- |
plugins/ldap/lib/ldap_authentication.rb
@@ -136,7 +136,7 @@ class LdapAuthentication | @@ -136,7 +136,7 @@ class LdapAuthentication | ||
136 | def self.get_attr(entry, attr_name) | 136 | def self.get_attr(entry, attr_name) |
137 | if !attr_name.blank? | 137 | if !attr_name.blank? |
138 | val = entry[attr_name].is_a?(Array) ? entry[attr_name].first : entry[attr_name] | 138 | val = entry[attr_name].is_a?(Array) ? entry[attr_name].first : entry[attr_name] |
139 | - charset = Magic.guess_string_mime(val).match(/charset=([^\s]+)/)[1] | 139 | + charset = Magic.guess_string_mime_encoding(val) |
140 | val.encode 'utf-8', charset, invalid: :replace, undef: :replace | 140 | val.encode 'utf-8', charset, invalid: :replace, undef: :replace |
141 | end | 141 | end |
142 | end | 142 | end |