Improve UserValidator default behavior [4.0 beta]#311
Improve UserValidator default behavior [4.0 beta]#311gabrielalmeida wants to merge 4 commits intoZizaco:huge-updatefrom
Conversation
|
@gabrielalmeida Good catch! My only concern is about changing the first parameter of For me it seems better to look for the About the the This way you will not have to pass What do you think about making these changes? You can create another PR if you like. |
src/Zizaco/Confide/UserValidator.php
Outdated
There was a problem hiding this comment.
Please indent with spaces. :P
|
The indentation here is wrong. There's a mix of tabs and spaces. There should only be spaces. |
|
@GrahamCampbell Yes you're right. I plan to fix then if @gabrielalmeida did not. |
|
I did this: 139d44b |
UserValidatorpresent design doesn't provide good UX practices and easy client-side validation via$user->errors.It overwrites
$user->errorseach timeUserValidator->attachErrorMsg()method runs, providing only 'one' error at time instead of all of them, making user progress at completing unvalidated fields slower and unintelligent.It also doesn't follow
MessageBagdefault behavior, which is a key corresponding to input names/model attributes and its respective value. It actually adds a MessageBag withconfidekey, so client-side validation by matching keys from$user->errorsisn't possible..Note that
UserValidator->ValidateIsUnique()method is still showing only first error but now at least exports correct error key to$user->errors.Unity test to
UserValidator->attachErrorMsg()must be updated if merged since it was redone to work directly with MessageBag object instead of ConfideUserInterface.