public function checkPasswordPolicy(Password $password)
    {
        $result = true;
        $policy = $this->picoAuth->getContainer()->get("PasswordPolicy");
        $maxAllowedLen = $this->getPasswordEncoder()->getMaxAllowedLen();
        if (is_int($maxAllowedLen) && strlen($password)>$maxAllowedLen) {
            $this->session->addFlash("error", "Maximum length is {$maxAllowedLen}.");
            $result = false;
        }
        if (!$policy->check($password)) {
            $errors = $policy->getErrors();
            foreach ($errors as $error) {
                $this->session->addFlash("error", $error);
            }
            return false;
        }
        
        return $result;
    }