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

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

        if (!$member->GUID) {
            $this->getLogger()->debug(sprintf('Cannot update Member ID %s, GUID not set', $member->ID));
            $validationResult->addError(
                _t(
                    'SilverStripe\\LDAP\\Authenticators\\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->addError(
                _t(
                    'SilverStripe\\LDAP\\Authenticators\\LDAPAuthenticator.NOUSER',
                    'Your account hasn\'t been setup properly, please contact an administrator.'
                )
            );
            return $validationResult;
        }

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

        return $validationResult;
    }