Skip to content

Commit

Permalink
Fixed #3585
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonkelly committed Dec 27, 2018
1 parent 26b356c commit 8e7011f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG-v3.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

### Fixed
- Fixed a bug where the “Edit” button on asset editor HUDs didn’t launch the Image Editor if the asset was being edited on another element type’s index page. ([#3575](https://github.com/craftcms/cms/issues/3575))
- Fixed an exception that would be thrown when saving a user from a front-end form with a non-empty `email` or `newPassword` param, if the `password` param was missing or empty. ([#3585](https://github.com/craftcms/cms/issues/3585))

## 3.0.36 - 2018-12-18

Expand Down
14 changes: 12 additions & 2 deletions src/controllers/UsersController.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
use craft\web\ServiceUnavailableHttpException;
use craft\web\UploadedFile;
use craft\web\View;
use yii\base\InvalidArgumentException;
use yii\web\BadRequestHttpException;
use yii\web\ForbiddenHttpException;
use yii\web\HttpException;
Expand Down Expand Up @@ -1752,9 +1753,18 @@ private function _verifyExistingPassword(): bool
}

$currentHashedPassword = $currentUser->password;
$currentPassword = Craft::$app->getRequest()->getRequiredParam('password');

return Craft::$app->getSecurity()->validatePassword($currentPassword, $currentHashedPassword);
try {
$currentPassword = Craft::$app->getRequest()->getRequiredParam('password');
} catch (BadRequestHttpException $e) {
return false;
}

try {
return Craft::$app->getSecurity()->validatePassword($currentPassword, $currentHashedPassword);
} catch (InvalidArgumentException $e) {
return false;
}
}

/**
Expand Down

0 comments on commit 8e7011f

Please sign in to comment.