public function SetPassword($uid, $pass) { $salt = ''; $hashed_pass = ulPassword::Hash($pass, $salt); $stmt = ulPdoDb::Prepare('update', 'UPDATE ul_logins SET password=? WHERE id=?'); if (!ulPdoDb::BindExec($stmt, NULL, array(&$hashed_pass, 'str', &$uid, 'int'))) { return ulLoginBackend::BACKEND_ERROR; } if ($stmt->rowCount() == 0) { return ulLoginBackend::NO_SUCH_USER; } return true; }
public function SetPassword($dn, $pass) { $binddn = UL_LDAP_PRIVILEGED_DN; $bindpwd = UL_LDAP_PRIVILEGED_PWD; $db = new ulLdapDb(); if (!$db->Bind($binddn, $bindpwd)) { $db->Fail(); return ulLoginBackend::ERROR; } $attribute[UL_LDAP_PWD_ATTRIB] = ulPassword::Hash($password, UL_LDAP_PWD_HASH); if (ldap_mod_replace($db->con, $dn, $attribute)) { return true; } else { return ulLoginBackend::ERROR; } }