public function setPassword(Member $member, $password, $oldPassword = null)
    {
        $validationResult = ValidationResult::create(true);

        $this->extend('onBeforeSetPassword', $member, $password, $validationResult);

        if (!$member->GUID) {
            SS_Log::log(sprintf('Cannot update Member ID %s, GUID not set', $member->ID), SS_Log::WARN);
            $validationResult->error(_t('LDAPAuthenticator.NOUSER', 'Your account hasn\'t been setup properly, please contact an administrator.'));
            return $validationResult;
        }

        $userData = $this->getUserByGUID($member->GUID);
        if (empty($userData['distinguishedname'])) {
            $validationResult->error(_t('LDAPAuthenticator.NOUSER', 'Your account hasn\'t been setup properly, please contact an administrator.'));
            return $validationResult;
        }

        try {
            if (!empty($oldPassword)) {
                $this->gateway->changePassword($userData['distinguishedname'], $password, $oldPassword);
            } else if ($this->config()->password_history_workaround) {
                $this->passwordHistoryWorkaround($userData['distinguishedname'], $password);
            } else {
                $this->gateway->resetPassword($userData['distinguishedname'], $password);
            }
            $this->extend('onAfterSetPassword', $member, $password, $validationResult);
        } catch (Exception $e) {
            $validationResult->error($e->getMessage());
        }

        return $validationResult;
    }