Commit 6a58cb55dcfdff6037efe8500ebce76a0d4982de
1 parent
bf93f2fa
Exists in
master
and in
1 other branch
Update README LDAP instructions [ci skip]
The instruction for the User model save hook don't work with the current versions of errbit and devise_ldap_authenticatable. This updates the code to use the initialization hook provides by the devise_ldap_authenticatable gem and also set the name, so validations in errbit pass.
Showing
1 changed file
with
7 additions
and
3 deletions
Show diff stats
README.md
@@ -323,9 +323,13 @@ Errbit::Config.devise_modules << :ldap_authenticatable | @@ -323,9 +323,13 @@ Errbit::Config.devise_modules << :ldap_authenticatable | ||
323 | before authentication. You must add the following lines to `app/models/user.rb`: | 323 | before authentication. You must add the following lines to `app/models/user.rb`: |
324 | 324 | ||
325 | ```ruby | 325 | ```ruby |
326 | - before_save :set_ldap_email | ||
327 | - def set_ldap_email | ||
328 | - self.email = Devise::LdapAdapter.get_ldap_param(self.username, "mail") | 326 | + def ldap_before_save |
327 | + name = Devise::LDAP::Adapter.get_ldap_param(self.username, "givenName") | ||
328 | + surname = Devise::LDAP::Adapter.get_ldap_param(self.username, "sn") | ||
329 | + mail = Devise::LDAP::Adapter.get_ldap_param(self.username, "mail") | ||
330 | + | ||
331 | + self.name = (name + surname).join ' ' | ||
332 | + self.email = mail.first | ||
329 | end | 333 | end |
330 | ``` | 334 | ``` |
331 | 335 |