Anomie has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/273937

Change subject: Allow API action=logout with BotPasswords
......................................................................

Allow API action=logout with BotPasswords

Since login is handled specially, do the same for logout.

Bug: T128335
Change-Id: Ib3b12d7045449b5c44f5ff7d1ecfce14416e8400
---
M includes/api/ApiLogout.php
1 file changed, 10 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/37/273937/1

diff --git a/includes/api/ApiLogout.php b/includes/api/ApiLogout.php
index 2c38208..6a26e2e 100644
--- a/includes/api/ApiLogout.php
+++ b/includes/api/ApiLogout.php
@@ -24,6 +24,8 @@
  * @file
  */
 
+use MediaWiki\Session\BotPasswordSessionProvider;
+
 /**
  * API module to allow users to log out of the wiki. API equivalent of
  * Special:Userlogout.
@@ -33,8 +35,15 @@
 class ApiLogout extends ApiBase {
 
        public function execute() {
-               // Make sure it's possible to log out
                $session = MediaWiki\Session\SessionManager::getGlobalSession();
+
+               // Handle bot password logout specially
+               if ( $session->getProvider() instanceof 
BotPasswordSessionProvider ) {
+                       $session->unpersist();
+                       return;
+               }
+
+               // Make sure it's possible to log out
                if ( !$session->canSetUser() ) {
                        $this->dieUsage(
                                'Cannot log out when using ' .

-- 
To view, visit https://gerrit.wikimedia.org/r/273937
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib3b12d7045449b5c44f5ff7d1ecfce14416e8400
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Anomie <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to