summaryrefslogtreecommitdiff
path: root/actions/subscribe.php
diff options
context:
space:
mode:
Diffstat (limited to 'actions/subscribe.php')
-rw-r--r--actions/subscribe.php9
1 files changed, 9 insertions, 0 deletions
diff --git a/actions/subscribe.php b/actions/subscribe.php
index 71452e46c..8bb723799 100644
--- a/actions/subscribe.php
+++ b/actions/subscribe.php
@@ -36,6 +36,15 @@ class SubscribeAction extends Action {
return;
}
+ # CSRF protection
+
+ $token = $this->trimmed('token');
+
+ if (!$token || $token != common_session_token()) {
+ common_redirect(common_local_url('subscriptions', array('nickname' => $user->nickname)));
+ return;
+ }
+
$other_nickname = $this->arg('subscribeto');
$result=subs_subscribe_user($user, $other_nickname);