Mercurial > prosody-modules
comparison mod_auth_ldap/mod_auth_ldap.lua @ 1192:db4085433e5f
mod_auth_ldap: Implement password change
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Tue, 17 Sep 2013 16:02:33 +0200 |
parents | c99d8b666eb4 |
children | 3e5f8e844325 |
comparison
equal
deleted
inserted
replaced
1191:1818a7f08580 | 1192:db4085433e5f |
---|---|
38 return provider.get_password(username) == password; | 38 return provider.get_password(username) == password; |
39 end | 39 end |
40 function provider.user_exists(username) | 40 function provider.user_exists(username) |
41 return not not get_user(username); | 41 return not not get_user(username); |
42 end | 42 end |
43 | 43 function provider.set_password(username, password) |
44 function provider.set_password(username, password) return nil, "Passwords unavailable for LDAP."; end | 44 local dn, attr = get_user(username); |
45 function provider.create_user(username, password) return nil, "Account creation/modification not available with LDAP."; end | 45 if not dn then return nil, attr end |
46 if attr.password ~= password then | |
47 ld:modify(dn, { '=', userPassword = password }); | |
48 end | |
49 return true | |
50 end | |
51 function provider.create_user(username, password) return nil, "Account creation not available with LDAP."; end | |
46 | 52 |
47 function provider.get_sasl_handler() | 53 function provider.get_sasl_handler() |
48 return new_sasl(module.host, { | 54 return new_sasl(module.host, { |
49 plain = function(sasl, username) | 55 plain = function(sasl, username) |
50 local password = provider.get_password(username); | 56 local password = provider.get_password(username); |