Skip to content

Commit

Permalink
Call requireCpRequest() for user photo actions (for now at least)
Browse files Browse the repository at this point in the history
see #3932
  • Loading branch information
brandonkelly committed Mar 4, 2019
1 parent a308a9e commit 406ad76
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/controllers/UsersController.php
Original file line number Diff line number Diff line change
Expand Up @@ -1223,8 +1223,10 @@ public function actionSaveUser()
*/
public function actionUploadUserPhoto()
{
$this->requireCpRequest();
$this->requireAcceptsJson();
$this->requireLogin();

$userId = Craft::$app->getRequest()->getRequiredBodyParam('userId');

if ($userId != Craft::$app->getUser()->getIdentity()->id) {
Expand Down Expand Up @@ -1273,11 +1275,14 @@ public function actionUploadUserPhoto()
* Delete all the photos for current user.
*
* @return Response
* @throws BadRequestHttpException
*/
public function actionDeleteUserPhoto(): Response
{
$this->requireCpRequest();
$this->requireAcceptsJson();
$this->requireLogin();

$userId = Craft::$app->getRequest()->getRequiredBodyParam('userId');

if ($userId != Craft::$app->getUser()->getIdentity()->id) {
Expand Down

0 comments on commit 406ad76

Please sign in to comment.