Update to real_save's "sidestep of validation" #110
Closed
+3
−3
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi Guys
I had a look at andrew13's postEdit in the great Laravel-4-Bootstrap-Starter site (https://github.com/andrew13/Laravel-4-Bootstrap-Starter-Site/blob/master/app/controllers/admin/AdminUsersController.php#L169)
The postEdit seemed to have way too much logic for handling the password and password confirmation.
I simplified the code to
but this didn't quite work.
On close inspection I found an if statement checking if $rules are empty in line 275 of ConfideUser.php. Basically $rules are passed all the time meaning this IF would never fire.
In this pull request I took the other route, instead of making a new set of rules, I simply delete the "password" rule from a pre-exiting set of rules.
With this change the code above runs correctly, ie. when the user enters a password, it is changes, but if he leaves it empty, it will stay the same without a validation error.
I also ran the PHPunit tests for Confide, all OK.