summaryrefslogtreecommitdiff
path: root/actions/unsubscribe.php
diff options
context:
space:
mode:
Diffstat (limited to 'actions/unsubscribe.php')
-rw-r--r--actions/unsubscribe.php9
1 files changed, 9 insertions, 0 deletions
diff --git a/actions/unsubscribe.php b/actions/unsubscribe.php
index 5814c37bd..e0392413d 100644
--- a/actions/unsubscribe.php
+++ b/actions/unsubscribe.php
@@ -33,6 +33,15 @@ class UnsubscribeAction 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('unsubscribeto');
$result=subs_unsubscribe_user($user,$other_nickname);
if($result!=true) {