X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=actions%2Favatar.php;h=9f397e93c3e0148248955ae8746308a489631f02;hb=bf14709fe2ed18f5a2641f841cb000a4856290fd;hp=ebfbd72952e9d1bec9ec315d3c958c948de38e4b;hpb=7e6870db914d4e905fc7ae833b69404fd3ea0d3d;p=quix0rs-gnu-social.git diff --git a/actions/avatar.php b/actions/avatar.php index ebfbd72952..9f397e93c3 100644 --- a/actions/avatar.php +++ b/actions/avatar.php @@ -58,6 +58,7 @@ class AvatarAction extends SettingsAction { 'id' => 'avatar', 'action' => common_local_url('avatar'))); + common_hidden('token', common_session_token()); common_element('input', array('name' => 'MAX_FILE_SIZE', 'type' => 'hidden', 'id' => 'MAX_FILE_SIZE', @@ -72,6 +73,14 @@ class AvatarAction extends SettingsAction { function handle_post() { + # CSRF protection + + $token = $this->trimmed('token'); + if (!$token || $token != common_session_token()) { + $this->show_form(_('There was a problem with your session token. Try again, please.')); + return; + } + switch ($_FILES['avatarfile']['error']) { case UPLOAD_ERR_OK: # success, jump out break;