domain must contain at least one dot

Signed-off-by: Simon L <szaimen@e.mail.de>
This commit is contained in:
Simon L 2023-04-01 14:05:40 +02:00
parent 7ccc699402
commit cc13161ec6

View file

@ -234,6 +234,11 @@ class ConfigurationManager
* @throws InvalidSettingConfigurationException * @throws InvalidSettingConfigurationException
*/ */
public function SetDomain(string $domain) : void { public function SetDomain(string $domain) : void {
// Validate that at least one dot is contained
if (strpos($domain, '.') === false) {
throw new InvalidSettingConfigurationException("Domain must contain at least one dot!");
}
// Validate domain // Validate domain
if (!filter_var($domain, FILTER_VALIDATE_DOMAIN, FILTER_FLAG_HOSTNAME)) { if (!filter_var($domain, FILTER_VALIDATE_DOMAIN, FILTER_FLAG_HOSTNAME)) {
throw new InvalidSettingConfigurationException("Domain is not a valid domain!"); throw new InvalidSettingConfigurationException("Domain is not a valid domain!");