Skip to content

Commit

Permalink
#7371 Add missing CSRF check (profile image upload)
Browse files Browse the repository at this point in the history
  • Loading branch information
asmecher committed Oct 19, 2021
1 parent af18ffb commit 3018049
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
4 changes: 4 additions & 0 deletions classes/user/form/PublicProfileForm.inc.php
Expand Up @@ -75,6 +75,10 @@ public function readInputData()
*/
public function uploadProfileImage()
{
if (!Application::get()->getRequest()->checkCSRF()) {
throw new \Exception('CSRF mismatch!');
}

$publicFileManager = new PublicFileManager();

$user = $this->getUser();
Expand Down
3 changes: 3 additions & 0 deletions templates/user/publicProfileForm.tpl
Expand Up @@ -26,6 +26,9 @@
{ldelim} title : "Image files", extensions : "jpg,jpeg,png,svg,gif" {rdelim}
]
{rdelim},
multipart_params: {ldelim}
csrfToken: {csrf type="json"}
{rdelim},
resize: {ldelim}
width: {$profileImageMaxWidth|intval},
height: {$profileImageMaxHeight|intval},
Expand Down

0 comments on commit 3018049

Please sign in to comment.