Symfony 3 Override FosUserBundle validators2019 Community Moderator ElectionSymfony form wrong property mapping in enitiesExtending FOSUserBundles Registration to have different fields stored in different tables?can't load registration formSymfony FOS User Bundle - Remove Username in Form and ViewComposer update with FOSUserBundle with ~2.0@dev having issueDuplicated password validation messages ONLY IF new password is 1 char longSymfony 3 - Fosuserbundle Registartion form getBlockPrefixSf2 : Fos UserBundle registration form, single field passwordFOSUserBundle - Embed formtypeSymfony2.8 -> 3.3 SonataCoreBundleFormExtensionDependencyInjectionExtension::__construct() must be of the type array, object given, called in
Giving a career talk in my old university, how prominently should I tell students my salary?
When Schnorr signatures are part of Bitcoin will it be possible validate each block with only one signature validation?
In the late 1940’s to early 1950’s what technology was available that could melt ice?
What is this diamond of every day?
What materials can be used to make a humanoid skin warm?
Is this Paypal Github SDK reference really a dangerous site?
Why couldn't the separatists legally leave the Republic?
Can I negotiate a patent idea for a raise, under French law?
QQ Plot and Shapiro Wilk Test Disagree
How do spaceships determine each other's mass in space?
Which situations would cause a company to ground or recall a aircraft series?
Shifting between bemols and diesis in the key signature
Is it safe to abruptly remove Arduino power?
Are all players supposed to be able to see each others' character sheets?
Source permutation
Is it a Cyclops number? "Nobody" knows!
What is the generally accepted pronunciation of “topoi”?
For which categories of spectra is there an explicit description of the fibrant objects via lifting properties?
What is better: yes / no radio, or simple checkbox?
What are you allowed to do while using the Warlock's Eldritch Master feature?
Vocabulary for giving just numbers, not a full answer
Can one live in the U.S. and not use a credit card?
School performs periodic password audits. Is my password compromised?
Can the alpha, lambda values of a glmnet object output determine whether ridge or Lasso?
Symfony 3 Override FosUserBundle validators
2019 Community Moderator ElectionSymfony form wrong property mapping in enitiesExtending FOSUserBundles Registration to have different fields stored in different tables?can't load registration formSymfony FOS User Bundle - Remove Username in Form and ViewComposer update with FOSUserBundle with ~2.0@dev having issueDuplicated password validation messages ONLY IF new password is 1 char longSymfony 3 - Fosuserbundle Registartion form getBlockPrefixSf2 : Fos UserBundle registration form, single field passwordFOSUserBundle - Embed formtypeSymfony2.8 -> 3.3 SonataCoreBundleFormExtensionDependencyInjectionExtension::__construct() must be of the type array, object given, called in
I am able to override FosUserBundle templates and controllers but I can't override registration form validator.
But it seems validation is disabled. Because even if the original validation file says that password needs 8 characters, I am able to register a new user with a one character password and I shouldn't.
config.yml:
fos_user:
registration:
form:
type: loicUserBundleFormRegistrationType
name: form_register_new
validation_groups: [Registration, Default]
confirmation:
enabled: false
template: FOSUserBundle:Registration:email.txt.twig
RegistrationType.php
<?php
namespace loicUserBundleForm;
use KMSFroalaEditorBundleFormTypeFroalaEditorType;
use loicEditorBundleFormEditorType;
use SymfonyComponentFormAbstractType;
use SymfonyComponentFormExtensionCoreTypeCheckboxType;
use SymfonyComponentFormExtensionCoreTypeCollectionType;
use SymfonyComponentFormExtensionCoreTypeTextareaType;
use SymfonyComponentFormFormBuilderInterface;
use SymfonyComponentFormExtensionCoreTypeChoiceType;
use SymfonyBridgeDoctrineFormTypeEntityType;
use loicContentBundleloicContentBundle;
use loicContentBundleEntityContent;
use DoctrineORMEntityRepository;
use SymfonyComponentFormExtensionCoreTypeTextType;
use SymfonyComponentOptionsResolverOptionsResolver;
use SymfonyComponentFormExtensionCoreTypeFileType;
use SymfonyComponentFormExtensionCoreTypePasswordType;
use SymfonyComponentFormExtensionCoreTypeRepeatedType;
class RegistrationType extends AbstractType
public function buildForm(FormBuilderInterface $builder, array $options)
$builder
->add('plainPassword', RepeatedType::class, array(
'type' => PasswordType::class,
'options' => array(
'translation_domain' => 'FOSUserBundle',
'attr' => array(
'autocomplete' => 'new-password',
),
),
'first_options' => array('label' => 'Mot de passe'),
'second_options' => array('label' => 'Confirmer le mot de passe'),
'invalid_message' => 'fos_user.password.mismatch',
))
->add('email',null,array(
'data' => time().'@gmail.com',
'label' => 'E-mail'
));
public function getName()
return $this->getBlockPrefix ();
/**
* @inheritdoc
*/
public function configureOptions(OptionsResolver $resolver)
$resolver->setDefaults(array(
"allow_extra_fields" => true
));
Thanks for help!
symfony fosuserbundle symfony3.4 symfony-validator
add a comment |
I am able to override FosUserBundle templates and controllers but I can't override registration form validator.
But it seems validation is disabled. Because even if the original validation file says that password needs 8 characters, I am able to register a new user with a one character password and I shouldn't.
config.yml:
fos_user:
registration:
form:
type: loicUserBundleFormRegistrationType
name: form_register_new
validation_groups: [Registration, Default]
confirmation:
enabled: false
template: FOSUserBundle:Registration:email.txt.twig
RegistrationType.php
<?php
namespace loicUserBundleForm;
use KMSFroalaEditorBundleFormTypeFroalaEditorType;
use loicEditorBundleFormEditorType;
use SymfonyComponentFormAbstractType;
use SymfonyComponentFormExtensionCoreTypeCheckboxType;
use SymfonyComponentFormExtensionCoreTypeCollectionType;
use SymfonyComponentFormExtensionCoreTypeTextareaType;
use SymfonyComponentFormFormBuilderInterface;
use SymfonyComponentFormExtensionCoreTypeChoiceType;
use SymfonyBridgeDoctrineFormTypeEntityType;
use loicContentBundleloicContentBundle;
use loicContentBundleEntityContent;
use DoctrineORMEntityRepository;
use SymfonyComponentFormExtensionCoreTypeTextType;
use SymfonyComponentOptionsResolverOptionsResolver;
use SymfonyComponentFormExtensionCoreTypeFileType;
use SymfonyComponentFormExtensionCoreTypePasswordType;
use SymfonyComponentFormExtensionCoreTypeRepeatedType;
class RegistrationType extends AbstractType
public function buildForm(FormBuilderInterface $builder, array $options)
$builder
->add('plainPassword', RepeatedType::class, array(
'type' => PasswordType::class,
'options' => array(
'translation_domain' => 'FOSUserBundle',
'attr' => array(
'autocomplete' => 'new-password',
),
),
'first_options' => array('label' => 'Mot de passe'),
'second_options' => array('label' => 'Confirmer le mot de passe'),
'invalid_message' => 'fos_user.password.mismatch',
))
->add('email',null,array(
'data' => time().'@gmail.com',
'label' => 'E-mail'
));
public function getName()
return $this->getBlockPrefix ();
/**
* @inheritdoc
*/
public function configureOptions(OptionsResolver $resolver)
$resolver->setDefaults(array(
"allow_extra_fields" => true
));
Thanks for help!
symfony fosuserbundle symfony3.4 symfony-validator
add a comment |
I am able to override FosUserBundle templates and controllers but I can't override registration form validator.
But it seems validation is disabled. Because even if the original validation file says that password needs 8 characters, I am able to register a new user with a one character password and I shouldn't.
config.yml:
fos_user:
registration:
form:
type: loicUserBundleFormRegistrationType
name: form_register_new
validation_groups: [Registration, Default]
confirmation:
enabled: false
template: FOSUserBundle:Registration:email.txt.twig
RegistrationType.php
<?php
namespace loicUserBundleForm;
use KMSFroalaEditorBundleFormTypeFroalaEditorType;
use loicEditorBundleFormEditorType;
use SymfonyComponentFormAbstractType;
use SymfonyComponentFormExtensionCoreTypeCheckboxType;
use SymfonyComponentFormExtensionCoreTypeCollectionType;
use SymfonyComponentFormExtensionCoreTypeTextareaType;
use SymfonyComponentFormFormBuilderInterface;
use SymfonyComponentFormExtensionCoreTypeChoiceType;
use SymfonyBridgeDoctrineFormTypeEntityType;
use loicContentBundleloicContentBundle;
use loicContentBundleEntityContent;
use DoctrineORMEntityRepository;
use SymfonyComponentFormExtensionCoreTypeTextType;
use SymfonyComponentOptionsResolverOptionsResolver;
use SymfonyComponentFormExtensionCoreTypeFileType;
use SymfonyComponentFormExtensionCoreTypePasswordType;
use SymfonyComponentFormExtensionCoreTypeRepeatedType;
class RegistrationType extends AbstractType
public function buildForm(FormBuilderInterface $builder, array $options)
$builder
->add('plainPassword', RepeatedType::class, array(
'type' => PasswordType::class,
'options' => array(
'translation_domain' => 'FOSUserBundle',
'attr' => array(
'autocomplete' => 'new-password',
),
),
'first_options' => array('label' => 'Mot de passe'),
'second_options' => array('label' => 'Confirmer le mot de passe'),
'invalid_message' => 'fos_user.password.mismatch',
))
->add('email',null,array(
'data' => time().'@gmail.com',
'label' => 'E-mail'
));
public function getName()
return $this->getBlockPrefix ();
/**
* @inheritdoc
*/
public function configureOptions(OptionsResolver $resolver)
$resolver->setDefaults(array(
"allow_extra_fields" => true
));
Thanks for help!
symfony fosuserbundle symfony3.4 symfony-validator
I am able to override FosUserBundle templates and controllers but I can't override registration form validator.
But it seems validation is disabled. Because even if the original validation file says that password needs 8 characters, I am able to register a new user with a one character password and I shouldn't.
config.yml:
fos_user:
registration:
form:
type: loicUserBundleFormRegistrationType
name: form_register_new
validation_groups: [Registration, Default]
confirmation:
enabled: false
template: FOSUserBundle:Registration:email.txt.twig
RegistrationType.php
<?php
namespace loicUserBundleForm;
use KMSFroalaEditorBundleFormTypeFroalaEditorType;
use loicEditorBundleFormEditorType;
use SymfonyComponentFormAbstractType;
use SymfonyComponentFormExtensionCoreTypeCheckboxType;
use SymfonyComponentFormExtensionCoreTypeCollectionType;
use SymfonyComponentFormExtensionCoreTypeTextareaType;
use SymfonyComponentFormFormBuilderInterface;
use SymfonyComponentFormExtensionCoreTypeChoiceType;
use SymfonyBridgeDoctrineFormTypeEntityType;
use loicContentBundleloicContentBundle;
use loicContentBundleEntityContent;
use DoctrineORMEntityRepository;
use SymfonyComponentFormExtensionCoreTypeTextType;
use SymfonyComponentOptionsResolverOptionsResolver;
use SymfonyComponentFormExtensionCoreTypeFileType;
use SymfonyComponentFormExtensionCoreTypePasswordType;
use SymfonyComponentFormExtensionCoreTypeRepeatedType;
class RegistrationType extends AbstractType
public function buildForm(FormBuilderInterface $builder, array $options)
$builder
->add('plainPassword', RepeatedType::class, array(
'type' => PasswordType::class,
'options' => array(
'translation_domain' => 'FOSUserBundle',
'attr' => array(
'autocomplete' => 'new-password',
),
),
'first_options' => array('label' => 'Mot de passe'),
'second_options' => array('label' => 'Confirmer le mot de passe'),
'invalid_message' => 'fos_user.password.mismatch',
))
->add('email',null,array(
'data' => time().'@gmail.com',
'label' => 'E-mail'
));
public function getName()
return $this->getBlockPrefix ();
/**
* @inheritdoc
*/
public function configureOptions(OptionsResolver $resolver)
$resolver->setDefaults(array(
"allow_extra_fields" => true
));
Thanks for help!
symfony fosuserbundle symfony3.4 symfony-validator
symfony fosuserbundle symfony3.4 symfony-validator
asked Mar 6 at 14:29
L01CL01C
728
728
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
Your new "password" field has no contraint. To test the validation, add a constraint and try again to register:
$builder->add('plainPassword', 'SymfonyComponentFormExtensionCoreTypeRepeatedType', array(
'type' => 'SymfonyComponentFormExtensionCoreTypePasswordType',
'options' => array('translation_domain' => 'FOSUserBundle'),
'first_options' => array('label' => 'form.password'),
'second_options' => array('label' => 'form.password_confirmation'),
'invalid_message' => 'fos_user.password.mismatch',
'constraints' => array(
new Length(['min' => 10]),
)
));
It works but I want to put all my constraints in a validation file as it should be with FOSUserBundle. A file or user entity annotations.
– L01C
Mar 7 at 8:17
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55025460%2fsymfony-3-override-fosuserbundle-validators%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Your new "password" field has no contraint. To test the validation, add a constraint and try again to register:
$builder->add('plainPassword', 'SymfonyComponentFormExtensionCoreTypeRepeatedType', array(
'type' => 'SymfonyComponentFormExtensionCoreTypePasswordType',
'options' => array('translation_domain' => 'FOSUserBundle'),
'first_options' => array('label' => 'form.password'),
'second_options' => array('label' => 'form.password_confirmation'),
'invalid_message' => 'fos_user.password.mismatch',
'constraints' => array(
new Length(['min' => 10]),
)
));
It works but I want to put all my constraints in a validation file as it should be with FOSUserBundle. A file or user entity annotations.
– L01C
Mar 7 at 8:17
add a comment |
Your new "password" field has no contraint. To test the validation, add a constraint and try again to register:
$builder->add('plainPassword', 'SymfonyComponentFormExtensionCoreTypeRepeatedType', array(
'type' => 'SymfonyComponentFormExtensionCoreTypePasswordType',
'options' => array('translation_domain' => 'FOSUserBundle'),
'first_options' => array('label' => 'form.password'),
'second_options' => array('label' => 'form.password_confirmation'),
'invalid_message' => 'fos_user.password.mismatch',
'constraints' => array(
new Length(['min' => 10]),
)
));
It works but I want to put all my constraints in a validation file as it should be with FOSUserBundle. A file or user entity annotations.
– L01C
Mar 7 at 8:17
add a comment |
Your new "password" field has no contraint. To test the validation, add a constraint and try again to register:
$builder->add('plainPassword', 'SymfonyComponentFormExtensionCoreTypeRepeatedType', array(
'type' => 'SymfonyComponentFormExtensionCoreTypePasswordType',
'options' => array('translation_domain' => 'FOSUserBundle'),
'first_options' => array('label' => 'form.password'),
'second_options' => array('label' => 'form.password_confirmation'),
'invalid_message' => 'fos_user.password.mismatch',
'constraints' => array(
new Length(['min' => 10]),
)
));
Your new "password" field has no contraint. To test the validation, add a constraint and try again to register:
$builder->add('plainPassword', 'SymfonyComponentFormExtensionCoreTypeRepeatedType', array(
'type' => 'SymfonyComponentFormExtensionCoreTypePasswordType',
'options' => array('translation_domain' => 'FOSUserBundle'),
'first_options' => array('label' => 'form.password'),
'second_options' => array('label' => 'form.password_confirmation'),
'invalid_message' => 'fos_user.password.mismatch',
'constraints' => array(
new Length(['min' => 10]),
)
));
answered Mar 6 at 14:40
Cristian BujoreanuCristian Bujoreanu
997617
997617
It works but I want to put all my constraints in a validation file as it should be with FOSUserBundle. A file or user entity annotations.
– L01C
Mar 7 at 8:17
add a comment |
It works but I want to put all my constraints in a validation file as it should be with FOSUserBundle. A file or user entity annotations.
– L01C
Mar 7 at 8:17
It works but I want to put all my constraints in a validation file as it should be with FOSUserBundle. A file or user entity annotations.
– L01C
Mar 7 at 8:17
It works but I want to put all my constraints in a validation file as it should be with FOSUserBundle. A file or user entity annotations.
– L01C
Mar 7 at 8:17
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55025460%2fsymfony-3-override-fosuserbundle-validators%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown