Merge "Reject authentication data change when there are warnings"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Tue, 7 Jun 2016 17:32:30 +0000 (17:32 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Tue, 7 Jun 2016 17:32:30 +0000 (17:32 +0000)
includes/Preferences.php
includes/auth/AuthManagerAuthPlugin.php
includes/specialpage/AuthManagerSpecialPage.php
includes/user/User.php

index 9a55ae3..3083a8d 100644 (file)
@@ -296,7 +296,7 @@ class Preferences {
 
                $allowPasswordChange = $wgDisableAuthManager ? $wgAuth->allowPasswordChange()
                        : AuthManager::singleton()->allowsAuthenticationDataChange(
-                               new PasswordAuthenticationRequest(), false );
+                               new PasswordAuthenticationRequest(), false )->isGood();
                if ( $canEditPrivateInfo && $allowPasswordChange ) {
                        $link = Linker::link( SpecialPage::getTitleFor( 'ChangePassword' ),
                                $context->msg( 'prefs-resetpass' )->escaped(), [],
index bf1e021..8d85b44 100644 (file)
@@ -131,7 +131,7 @@ class AuthManagerAuthPlugin extends \AuthPlugin {
                $reqs = AuthenticationRequest::loadRequestsFromSubmission( $reqs, $data );
                foreach ( $reqs as $req ) {
                        $status = AuthManager::singleton()->allowsAuthenticationDataChange( $req );
-                       if ( !$status->isOk() ) {
+                       if ( !$status->isGood() ) {
                                $this->logger->info( __METHOD__ . ': Password change rejected: {reason}', [
                                        'username' => $data['username'],
                                        'reason' => $status->getWikiText( null, null, 'en' ),
index 7866c12..41380f0 100644 (file)
@@ -375,7 +375,7 @@ abstract class AuthManagerSpecialPage extends SpecialPage {
                                $req = reset( $requests );
                                $status = $authManager->allowsAuthenticationDataChange( $req );
                                Hooks::run( 'ChangeAuthenticationDataAudit', [ $req, $status ] );
-                               if ( !$status->isOK() ) {
+                               if ( !$status->isGood() ) {
                                        return AuthenticationResponse::newFail( $status->getMessage() );
                                }
                                $authManager->changeAuthenticationData( $req );
index 9e50f36..8ecf468 100644 (file)
@@ -2569,7 +2569,7 @@ class User implements IDBAccessObject {
                        $reqs = AuthenticationRequest::loadRequestsFromSubmission( $reqs, $data );
                        foreach ( $reqs as $req ) {
                                $status = $manager->allowsAuthenticationDataChange( $req );
-                               if ( !$status->isOk() ) {
+                               if ( !$status->isGood() ) {
                                        \MediaWiki\Logger\LoggerFactory::getInstance( 'authentication' )
                                                ->info( __METHOD__ . ': Password change rejected: ' . $status->getWikiText() );
                                        return false;