X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=actions%2Fsubscribe.php;h=20c258923bb0b2b33fed38d1d156e27e8cbe155a;hb=31d5b61ca7daf72a847aed50eb65b672b52766f5;hp=71452e46ccda236bc06058c4daaabf29b2ee34b0;hpb=92645bbc578fafeb6816a44b8cf9cd594ffb5bd7;p=quix0rs-gnu-social.git diff --git a/actions/subscribe.php b/actions/subscribe.php index 71452e46cc..20c258923b 100644 --- a/actions/subscribe.php +++ b/actions/subscribe.php @@ -36,9 +36,19 @@ class SubscribeAction extends Action { return; } + # CSRF protection + + $token = $this->trimmed('token'); + + if (!$token || $token != common_session_token()) { + $this->client_error(_('There was a problem with your session token. Try again, please.')); + return; + } + $other_nickname = $this->arg('subscribeto'); $result=subs_subscribe_user($user, $other_nickname); + if($result != true) { common_user_error($result); return; @@ -47,5 +57,4 @@ class SubscribeAction extends Action { common_redirect(common_local_url('subscriptions', array('nickname' => $user->nickname))); } - } \ No newline at end of file