Change Class Default in CommonPasswordPolicy

This commit is contained in:
Jolien Trog 2025-09-01 13:30:59 +02:00
parent 7e95078239
commit 39bbc539f3
6 changed files with 17 additions and 11 deletions

3
.gitignore vendored
View File

@ -20,3 +20,6 @@ build/*
# Exclude dompdf font cache # Exclude dompdf font cache
library/vendor/dompdf/lib/fonts/*.php library/vendor/dompdf/lib/fonts/*.php
library/vendor/dompdf/lib/fonts/log.htm library/vendor/dompdf/lib/fonts/log.htm
#locale änderung für Tests sollen nicht gepushed werden
composer.json

View File

@ -4,7 +4,8 @@
namespace Icinga\Forms\Account; namespace Icinga\Forms\Account;
use Icinga\Application\Config; use Icinga\Application\Config;
use Icinga\Application\ProvidedHook\DefaultPasswordPolicy; use Icinga\Application\ProvidedHook\CommonPasswordPolicy;
use Icinga\Application\ProvidedHook\NoPasswordPolicy;
use Icinga\Authentication\PasswordValidator; use Icinga\Authentication\PasswordValidator;
use Icinga\Authentication\User\DbUserBackend; use Icinga\Authentication\User\DbUserBackend;
use Icinga\Data\Filter\Filter; use Icinga\Data\Filter\Filter;
@ -40,7 +41,7 @@ class ChangePasswordForm extends Form
$passwordPolicy = Config::app()->get( $passwordPolicy = Config::app()->get(
'global', 'global',
'password_policy', 'password_policy',
DefaultPasswordPolicy::class NoPasswordPolicy::class
); );
$passwordPolicyObject = new $passwordPolicy(); $passwordPolicyObject = new $passwordPolicy();
$passwordPolicyDescription = $passwordPolicyObject->getDescription(); $passwordPolicyDescription = $passwordPolicyObject->getDescription();

View File

@ -4,7 +4,8 @@
namespace Icinga\Forms\Config\General; namespace Icinga\Forms\Config\General;
use Icinga\Application\Hook; use Icinga\Application\Hook;
use Icinga\Application\ProvidedHook\DefaultPasswordPolicy; use Icinga\Application\ProvidedHook\CommonPasswordPolicy;
use Icinga\Application\ProvidedHook\NoPasswordPolicy;
use Icinga\Web\Form; use Icinga\Web\Form;
/** /**
@ -36,7 +37,7 @@ class PasswordPolicyConfigForm extends Form
'Enforce strong password requirements for new passwords' 'Enforce strong password requirements for new passwords'
), ),
'label' => $this->translate('Password Policy'), 'label' => $this->translate('Password Policy'),
'value' => DefaultPasswordPolicy::class, 'value' => NoPasswordPolicy::class,
'multiOptions' =>$passwordPolicies 'multiOptions' =>$passwordPolicies
] ]
); );

View File

@ -5,7 +5,8 @@ namespace Icinga\Forms\Config\User;
use Icinga\Application\Config; use Icinga\Application\Config;
use Icinga\Application\Hook\ConfigFormEventsHook; use Icinga\Application\Hook\ConfigFormEventsHook;
use Icinga\Application\ProvidedHook\DefaultPasswordPolicy; use Icinga\Application\ProvidedHook\CommonPasswordPolicy;
use Icinga\Application\ProvidedHook\NoPasswordPolicy;
use Icinga\Authentication\PasswordValidator; use Icinga\Authentication\PasswordValidator;
use Icinga\Data\Filter\Filter; use Icinga\Data\Filter\Filter;
use Icinga\Forms\RepositoryForm; use Icinga\Forms\RepositoryForm;
@ -23,7 +24,7 @@ class UserForm extends RepositoryForm
$passwordPolicy = Config::app()->get( $passwordPolicy = Config::app()->get(
'global', 'global',
'password_policy', 'password_policy',
DefaultPasswordPolicy::class NoPasswordPolicy::class
); );
$passwordPolicyObject = new $passwordPolicy(); $passwordPolicyObject = new $passwordPolicy();
$passwordPolicyDescription = $passwordPolicyObject->getDescription(); $passwordPolicyDescription = $passwordPolicyObject->getDescription();

View File

@ -7,7 +7,7 @@ use DirectoryIterator;
use ErrorException; use ErrorException;
use Exception; use Exception;
use Icinga\Application\ProvidedHook\DbMigration; use Icinga\Application\ProvidedHook\DbMigration;
use Icinga\Application\ProvidedHook\DefaultPasswordPolicy; use Icinga\Application\ProvidedHook\CommonPasswordPolicy;
use Icinga\Application\ProvidedHook\NoPasswordPolicy; use Icinga\Application\ProvidedHook\NoPasswordPolicy;
use ipl\I18n\GettextTranslator; use ipl\I18n\GettextTranslator;
use ipl\I18n\StaticTranslator; use ipl\I18n\StaticTranslator;
@ -742,7 +742,7 @@ abstract class ApplicationBootstrap
protected function registerApplicationHooks(): self protected function registerApplicationHooks(): self
{ {
Hook::register('DbMigration', DbMigration::class, DbMigration::class); Hook::register('DbMigration', DbMigration::class, DbMigration::class);
Hook::register('passwordpolicy', DefaultPasswordPolicy::class, DefaultPasswordPolicy::class); Hook::register('passwordpolicy', CommonPasswordPolicy::class, CommonPasswordPolicy::class);
Hook::register('passwordpolicy', NoPasswordPolicy::class, NoPasswordPolicy::class); Hook::register('passwordpolicy', NoPasswordPolicy::class, NoPasswordPolicy::class);
return $this; return $this;

View File

@ -7,7 +7,7 @@ use Icinga\Application\Hook\PasswordPolicyHook;
use ipl\I18n\Translation; use ipl\I18n\Translation;
/** /**
* Default implementation of a password policy * Common implementation of a password policy
* *
* Enforces: * Enforces:
* - Minimum length of 12 characters * - Minimum length of 12 characters
@ -16,13 +16,13 @@ use ipl\I18n\Translation;
* - At least one uppercase letter * - At least one uppercase letter
* - At least one lowercase letter * - At least one lowercase letter
*/ */
class DefaultPasswordPolicy implements PasswordPolicyHook class CommonPasswordPolicy implements PasswordPolicyHook
{ {
use Translation; use Translation;
public function getName(): string public function getName(): string
{ {
return $this->translate('Default'); return $this->translate('Common');
} }
public function getDescription(): string public function getDescription(): string