summaryrefslogtreecommitdiff
path: root/actions
diff options
context:
space:
mode:
Diffstat (limited to 'actions')
-rw-r--r--actions/apiblockcreate.php11
1 files changed, 11 insertions, 0 deletions
diff --git a/actions/apiblockcreate.php b/actions/apiblockcreate.php
index 4f941f6c3..e79dec32d 100644
--- a/actions/apiblockcreate.php
+++ b/actions/apiblockcreate.php
@@ -98,6 +98,17 @@ class ApiBlockCreateAction extends ApiAuthAction
return;
}
+ // Don't allow blocking yourself!
+
+ if ($this->user->id == $this->other->id) {
+ $this->clientError(
+ _("You cannot block yourself!"),
+ 403,
+ $this->format
+ );
+ return;
+ }
+
if ($this->user->hasBlocked($this->other)
|| $this->user->block($this->other)
) {