API: Add "messagecode" to AuthManager responses
authorBrad Jorsch <bjorsch@wikimedia.org>
Tue, 21 Feb 2017 17:06:41 +0000 (12:06 -0500)
committerBrad Jorsch <bjorsch@wikimedia.org>
Tue, 21 Feb 2017 17:06:41 +0000 (12:06 -0500)
Following the same logic that the API uses for assigning codes to
warnings and errors.

Bug: T158609
Change-Id: I4e1a4f252e12e990727e8e9ada4ea00c526e3f8f

includes/api/ApiAuthManagerHelper.php

index 5327d7a..d037c36 100644 (file)
@@ -208,6 +208,7 @@ class ApiAuthManagerHelper {
                        $res->status === AuthenticationResponse::RESTART
                ) {
                        $this->formatMessage( $ret, 'message', $res->message );
+                       $ret['messagecode'] = ApiMessage::create( $res->message )->getApiCode();
                }
 
                if ( $res->status === AuthenticationResponse::FAIL ||