Merge "API param validation: Add wrong value to error message on user params"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Sat, 9 Mar 2013 22:41:41 +0000 (22:41 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Sat, 9 Mar 2013 22:41:41 +0000 (22:41 +0000)
includes/WikiPage.php
includes/api/ApiCreateAccount.php

index 2da314f..da90811 100644 (file)
@@ -377,6 +377,7 @@ class WikiPage implements Page, IDBAccessObject {
         */
        public function loadFromRow( $data, $from ) {
                $lc = LinkCache::singleton();
+               $lc->clearLink( $this->mTitle );
 
                if ( $data ) {
                        $lc->addGoodLinkObjFromRow( $this->mTitle, $data );
index 7a36ce8..3f059d6 100644 (file)
@@ -108,8 +108,10 @@ class ApiCreateAccount extends ApiBase {
 
                $apiResult = $this->getResult();
 
-               if( $status->hasMessage( 'sessionfailure' ) ) {
-                       // Token was incorrect, so add it to result, but don't throw an exception.
+               if( $status->hasMessage( 'sessionfailure' ) || $status->hasMessage( 'nocookiesfornew' ) ) {
+                       // Token was incorrect, so add it to result, but don't throw an exception
+                       // since not having the correct token is part of the normal
+                       // flow of events.
                        $result['token'] = LoginForm::getCreateaccountToken();
                        $result['result'] = 'needtoken';
                } elseif( !$status->isOK() ) {
@@ -230,7 +232,6 @@ class ApiCreateAccount extends ApiBase {
        public function getPossibleErrors() {
                $localErrors = array(
                        'wrongpassword',
-                       'sessionfailure',
                        'sorbs_create_account_reason',
                        'noname',
                        'userexists',