From 7948cda40d2eccac647c6aa1ec51dfaef645a71c Mon Sep 17 00:00:00 2001 From: jannisp Date: Thu, 22 Apr 2021 15:20:24 +0200 Subject: [PATCH] use form validator --- composer.json | 2 + composer.lock | 458 +++++++++++++++++++++++++++- config/packages/test/validator.yaml | 3 + config/packages/validator.yaml | 8 + symfony.lock | 25 ++ 5 files changed, 495 insertions(+), 1 deletion(-) create mode 100644 config/packages/test/validator.yaml create mode 100644 config/packages/validator.yaml diff --git a/composer.json b/composer.json index 1bf2d5b..6d95b18 100644 --- a/composer.json +++ b/composer.json @@ -14,11 +14,13 @@ "symfony/console": "5.2.*", "symfony/dotenv": "5.2.*", "symfony/flex": "^1.3.1", + "symfony/form": "5.2.*", "symfony/framework-bundle": "5.2.*", "symfony/monolog-bundle": "^3.7", "symfony/proxy-manager-bridge": "5.2.*", "symfony/security-bundle": "5.2.*", "symfony/twig-bundle": "5.2.*", + "symfony/validator": "5.2.*", "symfony/yaml": "5.2.*", "twig/extra-bundle": "^2.12|^3.0", "twig/twig": "^2.12|^3.0" diff --git a/composer.lock b/composer.lock index af5b14a..28ad0b3 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "d038fb8157de3f613385ad08b78a68c9", + "content-hash": "ae1f737931efbb77621413dce9f11178", "packages": [ { "name": "composer/package-versions-deprecated", @@ -3109,6 +3109,107 @@ ], "time": "2021-02-16T14:05:05+00:00" }, + { + "name": "symfony/form", + "version": "v5.2.6", + "source": { + "type": "git", + "url": "https://github.com/symfony/form.git", + "reference": "40fbaed8d4238e37fdd1fecce8e0678a3eb0e48b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/form/zipball/40fbaed8d4238e37fdd1fecce8e0678a3eb0e48b", + "reference": "40fbaed8d4238e37fdd1fecce8e0678a3eb0e48b", + "shasum": "" + }, + "require": { + "php": ">=7.2.5", + "symfony/deprecation-contracts": "^2.1", + "symfony/event-dispatcher": "^4.4|^5.0", + "symfony/intl": "^4.4|^5.0", + "symfony/options-resolver": "^5.1", + "symfony/polyfill-ctype": "~1.8", + "symfony/polyfill-mbstring": "~1.0", + "symfony/polyfill-php80": "^1.15", + "symfony/property-access": "^5.0.8", + "symfony/service-contracts": "^1.1|^2" + }, + "conflict": { + "phpunit/phpunit": "<5.4.3", + "symfony/console": "<4.4", + "symfony/dependency-injection": "<4.4", + "symfony/doctrine-bridge": "<4.4", + "symfony/error-handler": "<4.4.5", + "symfony/framework-bundle": "<4.4", + "symfony/http-kernel": "<4.4", + "symfony/intl": "<4.4", + "symfony/translation": "<4.4", + "symfony/translation-contracts": "<1.1.7", + "symfony/twig-bridge": "<4.4" + }, + "require-dev": { + "doctrine/collections": "~1.0", + "symfony/config": "^4.4|^5.0", + "symfony/console": "^4.4|^5.0", + "symfony/dependency-injection": "^4.4|^5.0", + "symfony/expression-language": "^4.4|^5.0", + "symfony/http-foundation": "^4.4|^5.0", + "symfony/http-kernel": "^4.4|^5.0", + "symfony/security-csrf": "^4.4|^5.0", + "symfony/translation": "^4.4|^5.0", + "symfony/validator": "^4.4.17|^5.1.9", + "symfony/var-dumper": "^4.4|^5.0" + }, + "suggest": { + "symfony/security-csrf": "For protecting forms against CSRF attacks.", + "symfony/twig-bridge": "For templating with Twig.", + "symfony/validator": "For form validation." + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\Form\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Allows to easily create, process and reuse HTML forms", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/form/tree/v5.2.6" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2021-03-28T09:59:03+00:00" + }, { "name": "symfony/framework-bundle", "version": "v5.2.6", @@ -3521,6 +3622,94 @@ ], "time": "2021-03-29T05:16:58+00:00" }, + { + "name": "symfony/intl", + "version": "v5.2.4", + "source": { + "type": "git", + "url": "https://github.com/symfony/intl.git", + "reference": "11b4217e394c80a2e313d3a4a37262fbe65a7add" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/intl/zipball/11b4217e394c80a2e313d3a4a37262fbe65a7add", + "reference": "11b4217e394c80a2e313d3a4a37262fbe65a7add", + "shasum": "" + }, + "require": { + "php": ">=7.2.5", + "symfony/polyfill-intl-icu": "~1.0", + "symfony/polyfill-php80": "^1.15" + }, + "require-dev": { + "symfony/filesystem": "^4.4|^5.0" + }, + "suggest": { + "ext-intl": "to use the component with locales other than \"en\"" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\Intl\\": "" + }, + "classmap": [ + "Resources/stubs" + ], + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Bernhard Schussek", + "email": "bschussek@gmail.com" + }, + { + "name": "Eriksen Costa", + "email": "eriksen.costa@infranology.com.br" + }, + { + "name": "Igor Wiedler", + "email": "igor@wiedler.ch" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Provides a PHP replacement layer for the C intl extension that includes additional data from the ICU library", + "homepage": "https://symfony.com", + "keywords": [ + "i18n", + "icu", + "internationalization", + "intl", + "l10n", + "localization" + ], + "support": { + "source": "https://github.com/symfony/intl/tree/v5.2.4" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2021-02-18T22:42:36+00:00" + }, { "name": "symfony/monolog-bridge", "version": "v5.2.5", @@ -3684,6 +3873,75 @@ ], "time": "2021-03-31T07:20:47+00:00" }, + { + "name": "symfony/options-resolver", + "version": "v5.2.4", + "source": { + "type": "git", + "url": "https://github.com/symfony/options-resolver.git", + "reference": "5d0f633f9bbfcf7ec642a2b5037268e61b0a62ce" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/options-resolver/zipball/5d0f633f9bbfcf7ec642a2b5037268e61b0a62ce", + "reference": "5d0f633f9bbfcf7ec642a2b5037268e61b0a62ce", + "shasum": "" + }, + "require": { + "php": ">=7.2.5", + "symfony/deprecation-contracts": "^2.1", + "symfony/polyfill-php73": "~1.0", + "symfony/polyfill-php80": "^1.15" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\OptionsResolver\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Provides an improved replacement for the array_replace PHP function", + "homepage": "https://symfony.com", + "keywords": [ + "config", + "configuration", + "options" + ], + "support": { + "source": "https://github.com/symfony/options-resolver/tree/v5.2.4" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2021-01-27T12:56:27+00:00" + }, { "name": "symfony/polyfill-intl-grapheme", "version": "v1.22.1", @@ -3765,6 +4023,93 @@ ], "time": "2021-01-22T09:19:47+00:00" }, + { + "name": "symfony/polyfill-intl-icu", + "version": "v1.22.1", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-intl-icu.git", + "reference": "af1842919c7e7364aaaa2798b29839e3ba168588" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-intl-icu/zipball/af1842919c7e7364aaaa2798b29839e3ba168588", + "reference": "af1842919c7e7364aaaa2798b29839e3ba168588", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "suggest": { + "ext-intl": "For best performance and support of other locales than \"en\"" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.22-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Intl\\Icu\\": "" + }, + "classmap": [ + "Resources/stubs" + ], + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for intl's ICU-related data and classes", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "icu", + "intl", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-intl-icu/tree/v1.22.1" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2021-01-22T09:19:47+00:00" + }, { "name": "symfony/polyfill-intl-normalizer", "version": "v1.22.1", @@ -5337,6 +5682,117 @@ ], "time": "2021-01-27T10:15:41+00:00" }, + { + "name": "symfony/validator", + "version": "v5.2.6", + "source": { + "type": "git", + "url": "https://github.com/symfony/validator.git", + "reference": "67354644f9baba3cc122134c255b7461b7e0fe31" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/validator/zipball/67354644f9baba3cc122134c255b7461b7e0fe31", + "reference": "67354644f9baba3cc122134c255b7461b7e0fe31", + "shasum": "" + }, + "require": { + "php": ">=7.2.5", + "symfony/deprecation-contracts": "^2.1", + "symfony/polyfill-ctype": "~1.8", + "symfony/polyfill-mbstring": "~1.0", + "symfony/polyfill-php73": "~1.0", + "symfony/polyfill-php80": "^1.15", + "symfony/translation-contracts": "^1.1|^2" + }, + "conflict": { + "doctrine/lexer": "<1.0.2", + "phpunit/phpunit": "<5.4.3", + "symfony/dependency-injection": "<4.4", + "symfony/expression-language": "<5.1", + "symfony/http-kernel": "<4.4", + "symfony/intl": "<4.4", + "symfony/translation": "<4.4", + "symfony/yaml": "<4.4" + }, + "require-dev": { + "doctrine/annotations": "^1.10.4", + "doctrine/cache": "~1.0", + "egulias/email-validator": "^2.1.10|^3", + "symfony/cache": "^4.4|^5.0", + "symfony/config": "^4.4|^5.0", + "symfony/console": "^4.4|^5.0", + "symfony/dependency-injection": "^4.4|^5.0", + "symfony/expression-language": "^5.1", + "symfony/finder": "^4.4|^5.0", + "symfony/http-client": "^4.4|^5.0", + "symfony/http-foundation": "^4.4|^5.0", + "symfony/http-kernel": "^4.4|^5.0", + "symfony/intl": "^4.4|^5.0", + "symfony/mime": "^4.4|^5.0", + "symfony/property-access": "^4.4|^5.0", + "symfony/property-info": "^4.4|^5.0", + "symfony/translation": "^4.4|^5.0", + "symfony/yaml": "^4.4|^5.0" + }, + "suggest": { + "doctrine/annotations": "For using the annotation mapping. You will also need doctrine/cache.", + "doctrine/cache": "For using the default cached annotation reader.", + "egulias/email-validator": "Strict (RFC compliant) email validation", + "psr/cache-implementation": "For using the mapping cache.", + "symfony/config": "", + "symfony/expression-language": "For using the Expression validator and the ExpressionLanguageSyntax constraints", + "symfony/http-foundation": "", + "symfony/intl": "", + "symfony/property-access": "For accessing properties within comparison constraints", + "symfony/property-info": "To automatically add NotNull and Type constraints", + "symfony/translation": "For translating validation errors.", + "symfony/yaml": "" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\Validator\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Provides tools to validate values", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/validator/tree/v5.2.6" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2021-03-23T12:45:44+00:00" + }, { "name": "symfony/var-dumper", "version": "v5.2.6", diff --git a/config/packages/test/validator.yaml b/config/packages/test/validator.yaml new file mode 100644 index 0000000..1e5ab78 --- /dev/null +++ b/config/packages/test/validator.yaml @@ -0,0 +1,3 @@ +framework: + validation: + not_compromised_password: false diff --git a/config/packages/validator.yaml b/config/packages/validator.yaml new file mode 100644 index 0000000..350786a --- /dev/null +++ b/config/packages/validator.yaml @@ -0,0 +1,8 @@ +framework: + validation: + email_validation_mode: html5 + + # Enables validator auto-mapping support. + # For instance, basic validation constraints will be inferred from Doctrine's metadata. + #auto_mapping: + # App\Entity\: [] diff --git a/symfony.lock b/symfony.lock index 9a74569..acef62f 100644 --- a/symfony.lock +++ b/symfony.lock @@ -187,6 +187,9 @@ ".env" ] }, + "symfony/form": { + "version": "v5.2.6" + }, "symfony/framework-bundle": { "version": "5.2", "recipe": { @@ -216,6 +219,9 @@ "symfony/http-kernel": { "version": "v5.2.6" }, + "symfony/intl": { + "version": "v5.2.4" + }, "symfony/maker-bundle": { "version": "1.0", "recipe": { @@ -243,12 +249,18 @@ "config/packages/test/monolog.yaml" ] }, + "symfony/options-resolver": { + "version": "v5.2.4" + }, "symfony/orm-pack": { "version": "v2.1.0" }, "symfony/polyfill-intl-grapheme": { "version": "v1.22.1" }, + "symfony/polyfill-intl-icu": { + "version": "v1.22.1" + }, "symfony/polyfill-intl-normalizer": { "version": "v1.22.1" }, @@ -343,6 +355,19 @@ "symfony/twig-pack": { "version": "v1.0.1" }, + "symfony/validator": { + "version": "4.3", + "recipe": { + "repo": "github.com/symfony/recipes", + "branch": "master", + "version": "4.3", + "ref": "d902da3e4952f18d3bf05aab29512eb61cabd869" + }, + "files": [ + "config/packages/test/validator.yaml", + "config/packages/validator.yaml" + ] + }, "symfony/var-dumper": { "version": "v5.2.6" },