|
Elgg
Version master
|
Password generator service. More...
Public Member Functions | |
| __construct (protected Config $config, protected Translator $translator, protected EventsService $events) | |
| Constructor. More... | |
| generatePassword (int $length=12) | |
| Generate a new random password. More... | |
| assertValidPassword (string $password) | |
| Assert that a given string matches the password requirements. More... | |
| isValidPassword (string $password) | |
| Validate that a given string matches the password requirements. More... | |
| getInputRegEx () | |
| Get the regex to set on an input/password to validate password requirements during input. More... | |
| getPasswordRequirementsDescription () | |
| Get a description of how a valid password should be made. More... | |
| addInputRequirements (\Elgg\Event $event) | |
| Add the security password requirements to an input/password field. More... | |
| registerUserPasswordValidation (\Elgg\Event $event) | |
| Validate password during user registration. More... | |
Protected Member Functions | |
| getGenerator () | |
| Get helper generator. More... | |
| getValidLength (int $length) | |
| Make sure the password length requirement can be met by the password settings. More... | |
| validatePasswordLength (string $password) | |
| Validate that a password meets the minimal length requirement. More... | |
Password generator service.
Can generate and validate passwords based on config settings regarding password requirements
Definition at line 22 of file PasswordGeneratorService.php.
| Elgg\Security\PasswordGeneratorService::__construct | ( | protected Config | $config, |
| protected Translator | $translator, | ||
| protected EventsService | $events | ||
| ) |
Constructor.
| Config | $config | Elgg config |
| Translator | $translator | Translator |
| EventsService | $events | Events service |
Definition at line 31 of file PasswordGeneratorService.php.
| Elgg\Security\PasswordGeneratorService::addInputRequirements | ( | \Elgg\Event | $event | ) |
Add the security password requirements to an input/password field.
| \Elgg\Event | $event | 'view_vars', 'input/password' |
Definition at line 224 of file PasswordGeneratorService.php.
| Elgg\Security\PasswordGeneratorService::assertValidPassword | ( | string | $password | ) |
Assert that a given string matches the password requirements.
| string | $password | the password to validate |
| InvalidPasswordLengthException | |
| InvalidPasswordCharacterRequirementsException |
Definition at line 64 of file PasswordGeneratorService.php.
| Elgg\Security\PasswordGeneratorService::generatePassword | ( | int | $length = 12 | ) |
Generate a new random password.
| int | $length | the length of the password (can't be less the minimal password length config setting) |
Definition at line 45 of file PasswordGeneratorService.php.
|
protected |
Get helper generator.
Definition at line 269 of file PasswordGeneratorService.php.
| Elgg\Security\PasswordGeneratorService::getInputRegEx | ( | ) |
Get the regex to set on an input/password to validate password requirements during input.
Note: This regex is meant for use in html/javascript NOT PHP
Definition at line 105 of file PasswordGeneratorService.php.
| Elgg\Security\PasswordGeneratorService::getPasswordRequirementsDescription | ( | ) |
Get a description of how a valid password should be made.
Definition at line 169 of file PasswordGeneratorService.php.
|
protected |
Make sure the password length requirement can be met by the password settings.
| int | $length | the requested length |
Definition at line 331 of file PasswordGeneratorService.php.
| Elgg\Security\PasswordGeneratorService::isValidPassword | ( | string | $password | ) |
Validate that a given string matches the password requirements.
| string | $password | the password to validate |
Definition at line 84 of file PasswordGeneratorService.php.
| Elgg\Security\PasswordGeneratorService::registerUserPasswordValidation | ( | \Elgg\Event | $event | ) |
Validate password during user registration.
| \Elgg\Event | $event | 'registeruser:validate:password', 'all' |
| RegistrationException |
Definition at line 250 of file PasswordGeneratorService.php.
|
protected |
Validate that a password meets the minimal length requirement.
| string | $password | the password to check |
Definition at line 349 of file PasswordGeneratorService.php.