-
Notifications
You must be signed in to change notification settings - Fork 258
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve UserValidator default behavior [4.0 beta] #311
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. |
@@ -63,6 +66,9 @@ public function validate(ConfideUserInterface $user, $ruleset = 'create') | |||
// Set the $repo as a ConfideRepository object | |||
$this->repo = App::make('confide.repository'); | |||
|
|||
// Set $user->errors as a MessageBag object |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
UserValidator
present design doesn't provide good UX practices and easy client-side validation via$user->errors
.It overwrites
$user->errors
each 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
MessageBag
default behavior, which is a key corresponding to input names/model attributes and its respective value. It actually adds a MessageBag withconfide
key, so client-side validation by matching keys from$user->errors
isn'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.