├── LICENSE ├── README.md ├── UPGRADE.md ├── composer.json └── src ├── DependencyInjection └── RollerworksPasswordStrengthExtension.php ├── Resources └── config │ └── strength_validator.xml └── RollerworksPasswordStrengthBundle.php /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2012-present Sebastiaan Stok 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is furnished 8 | to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all 11 | copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | RollerworksPasswordStrengthBundle 2 | ================================= 3 | 4 | This Symfony-bundle integrates the Rollerworks [PasswordStrengthValidator][component] into your Symfony application. 5 | 6 | _The PasswordStrengthValidator provides various password strength validators for the Symfony Validator._ 7 | 8 | > This bundle provides the same level of functionality as the 9 | > [PasswordStrengthBundle](https://github.com/jbafford/PasswordStrengthBundle) created by John Bafford. 10 | > And is considered a replacement of the original bundle. 11 | 12 | ## Installation 13 | 14 | To install this package, add `rollerworks/password-strength-bundle` to your composer.json: 15 | 16 | ```bash 17 | $ php composer.phar require rollerworks/password-strength-bundle 18 | ``` 19 | 20 | Now, [Composer][composer] will automatically download all required files, 21 | and install them for you. 22 | 23 | [Symfony Flex][flex]is assumed to enable the Bundle and add required configuration. 24 | https://symfony.com/doc/current/bundles.html 25 | 26 | Otherwise enable the `Rollerworks\Bundle\PasswordStrengthBundle\RollerworksPasswordStrengthBundle`. 27 | 28 | ## Requirements 29 | 30 | You need at least PHP PHP 8.2, mbstring is recommended but not required, and at least Symfony 6. 31 | 32 | ## Basic Usage 33 | 34 | Documentation for the various constraints can be found in the [PasswordStrengthValidator][component] package. 35 | 36 | ## Versioning 37 | 38 | For transparency and insight into the release cycle, and for striving 39 | to maintain backward compatibility, this package is maintained under 40 | the Semantic Versioning guidelines as much as possible. 41 | 42 | Releases will be numbered with the following format: 43 | 44 | `..` 45 | 46 | And constructed with the following guidelines: 47 | 48 | * Breaking backward compatibility bumps the major (and resets the minor and patch) 49 | * New additions without breaking backward compatibility bumps the minor (and resets the patch) 50 | * Bug fixes and misc changes bumps the patch 51 | 52 | For more information on SemVer, please visit . 53 | 54 | ## License 55 | 56 | This library is released under the [MIT license](LICENSE). 57 | 58 | ## Contributing 59 | 60 | This is an open source project. If you'd like to contribute, 61 | please read the [Contributing Guidelines][contributing]. If you're submitting 62 | a pull request, please follow the guidelines in the [Submitting a Patch][patches] section. 63 | 64 | [component]: https://github.com/rollerworks/PasswordStrengthValidator 65 | [composer]: https://getcomposer.org/doc/00-intro.md 66 | [flex]: https://symfony.com/doc/current/setup/flex.html 67 | [contributing]: https://contributing.rollerscapes.net/ 68 | [patches]: https://contributing.rollerscapes.net/latest/patches.html 69 | -------------------------------------------------------------------------------- /UPGRADE.md: -------------------------------------------------------------------------------- 1 | UPGRADE 2 | ======= 3 | 4 | From 2.x to 3.0 5 | --------------- 6 | 7 | * The blacklist validator was removed. 8 | 9 | Use the [NotCompromisedPassword](https://symfony.com/doc/current/reference/constraints/NotCompromisedPassword.html) 10 | validator or [PasswordCommonList Validator](https://github.com/rollerworks/password-common-list) instead. 11 | 12 | * Support for Symfony 4 and 5 was removed, PHP 8.2 and Symfony 6.0 is now the minimum required version. 13 | 14 | From 1.x to 2.0 15 | --------------- 16 | 17 | Most of this bundle's content has been moved to a separate library 18 | at https://github.com/rollerworks/PasswordStrengthValidator. 19 | 20 | You will need to update your class imports to point to the component's 21 | namespace. 22 | 23 | All deprecated code has been removed. And support for Symfony 2 and anything 24 | lower then PHP 5.6 was dropped. Official support for HHVM is also dropped. 25 | 26 | You need at least Symfony 3.3 and PHP 5.6 (or PHP 7.0). 27 | 28 | Constraints 29 | ----------- 30 | 31 | The constraints have been moved to a separate library. 32 | Update your imports to point to the new namespace. 33 | 34 | Before: 35 | 36 | ```php 37 | use Rollerworks\Bundle\PasswordStrengthBundle\Validator\Constraints as RollerworksPassword; 38 | ``` 39 | 40 | After: 41 | 42 | ```php 43 | use Rollerworks\Component\PasswordStrength\Validator\Constraints as RollerworksPassword; 44 | ``` 45 | 46 | ChainLoader 47 | ----------- 48 | 49 | A new `LazyChainLoader` has been added in the library, it is are recommended 50 | to use this loader instead of the old `ChainLoader`. 51 | 52 | To enable this loader update your configuration as follow. 53 | 54 | Before: 55 | 56 | ```yaml 57 | rollerworks_password_strength: 58 | blacklist: 59 | default_provider: rollerworks_password_strength.blacklist.provider.sqlite 60 | providers: 61 | chain: 62 | providers: 63 | - rollerworks_password_strength.blacklist.provider.array 64 | - rollerworks_password_strength.blacklist.provider.sqlite 65 | ``` 66 | 67 | After: 68 | 69 | ```yaml 70 | rollerworks_password_strength: 71 | blacklist: 72 | default_provider: rollerworks_password_strength.blacklist.provider.sqlite 73 | providers: 74 | chain: 75 | lazy: true 76 | providers: 77 | - rollerworks_password_strength.blacklist.provider.array 78 | - rollerworks_password_strength.blacklist.provider.sqlite 79 | ``` 80 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "rollerworks/password-strength-bundle", 3 | "description": "Password-strength validator bundle for Symfony", 4 | "license": "MIT", 5 | "type": "symfony-bundle", 6 | "keywords": [ 7 | "password", 8 | "validator", 9 | "symfony", 10 | "bundle" 11 | ], 12 | "authors": [ 13 | { 14 | "name": "Sebastiaan Stok", 15 | "email": "s.stok@rollercapes.net" 16 | }, 17 | { 18 | "name": "Community contributions", 19 | "homepage": "https://github.com/rollerworks/PasswordStrengthBundle/contributors" 20 | } 21 | ], 22 | "require": { 23 | "php": ">=8.2", 24 | "rollerworks/password-strength-validator": "^2.0", 25 | "symfony/framework-bundle": "^6.0 || ^7.0" 26 | }, 27 | "require-dev": { 28 | "matthiasnoback/symfony-dependency-injection-test": "^5.0 || ^v4.3.1", 29 | "phpunit/phpunit": "^9.5", 30 | "rollerscapes/standards": "^1.0", 31 | "symfony/phpunit-bridge": "^6.0 || ^7.0" 32 | }, 33 | "minimum-stability": "dev", 34 | "prefer-stable": true, 35 | "autoload": { 36 | "psr-4": { 37 | "Rollerworks\\Bundle\\PasswordStrengthBundle\\": "src/" 38 | }, 39 | "exclude-from-classmap": [ 40 | "test/" 41 | ] 42 | }, 43 | "autoload-dev": { 44 | "psr-4": { 45 | "Rollerworks\\Bundle\\PasswordStrengthBundle\\Tests\\": "tests/" 46 | } 47 | }, 48 | "config": { 49 | "allow-plugins": { 50 | "symfony/flex": true 51 | } 52 | }, 53 | "extra": { 54 | "branch-alias": { 55 | "dev-main": "3.0-dev" 56 | } 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /src/DependencyInjection/RollerworksPasswordStrengthExtension.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * This source file is subject to the MIT license that is bundled 9 | * with this source code in the file LICENSE. 10 | */ 11 | 12 | namespace Rollerworks\Bundle\PasswordStrengthBundle\DependencyInjection; 13 | 14 | use Rollerworks\Component\PasswordStrength\Validator\Constraints\PasswordStrength; 15 | use Symfony\Component\Config\FileLocator; 16 | use Symfony\Component\DependencyInjection\ContainerBuilder; 17 | use Symfony\Component\DependencyInjection\Extension\Extension; 18 | use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface; 19 | use Symfony\Component\DependencyInjection\Loader; 20 | 21 | final class RollerworksPasswordStrengthExtension extends Extension implements PrependExtensionInterface 22 | { 23 | public function load(array $configs, ContainerBuilder $container): void 24 | { 25 | $loader = new Loader\XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config')); 26 | $loader->load('strength_validator.xml'); 27 | } 28 | 29 | public function prepend(ContainerBuilder $container): void 30 | { 31 | $container->prependExtensionConfig('framework', [ 32 | 'translator' => [ 33 | 'paths' => [ 34 | \dirname((new \ReflectionClass(PasswordStrength::class))->getFileName(), 3) . '/Resources/translations', 35 | ], 36 | ], 37 | ]); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Resources/config/strength_validator.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /src/RollerworksPasswordStrengthBundle.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * This source file is subject to the MIT license that is bundled 9 | * with this source code in the file LICENSE. 10 | */ 11 | 12 | namespace Rollerworks\Bundle\PasswordStrengthBundle; 13 | 14 | use Symfony\Component\HttpKernel\Bundle\Bundle; 15 | 16 | final class RollerworksPasswordStrengthBundle extends Bundle {} 17 | --------------------------------------------------------------------------------