Gergő Tisza has uploaded a new change for review. https://gerrit.wikimedia.org/r/265181
Change subject: [FIXUP] Fix autolinking ...................................................................... [FIXUP] Fix autolinking continueRequests needs to be preserved because it will be used to validate continue submissions. Kept neededRequests but it seems to be unnecessary now that getAuthenticationRequests with the continue action always gives the same result. Change-Id: Ic0c733d6f29a249ad99fd255ca03c8fd23f0ea1f --- M includes/auth/AuthManager.php M includes/auth/AuthenticationRequest.php M includes/auth/AuthenticationResponse.php M languages/i18n/en.json 4 files changed, 20 insertions(+), 13 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/81/265181/1 diff --git a/includes/auth/AuthManager.php b/includes/auth/AuthManager.php index a4ccf6e..1e0f488 100644 --- a/includes/auth/AuthManager.php +++ b/includes/auth/AuthManager.php @@ -352,7 +352,10 @@ * AuthManager::continueAuthentication() should be called. * - status RESTART: The user logged in successfully with a third-party * service, but the third-party credentials aren't attached to any local - * account. This could be treated as a UI or a FAIL. + * account. This could be treated as a UI or a FAIL. In the second case, + * if it is followed up by an account creation process, the $createRequest + * in the response should be passed to AuthManager::beginAccountCreation() + * after adding a local username. * - status PASS: Authentication was successful. * * @param AuthenticationRequest[] $reqs @@ -511,20 +514,24 @@ $this->logger->info( "Primary login with {$provider->getUniqueId()} succeeded, but returned no user" ); + $ret = AuthenticationResponse::newRestart( wfMessage( $msg ) ); + $restartRequests = $this->getAuthenticationRequestsInternal( self::ACTION_LOGIN, + array(), $this->getPrimaryAuthenticationProviders() + + $this->getSecondaryAuthenticationProviders() ); + if ( $res->createRequest || $state['maybeLink'] ) { + $createRequest = new CreateFromLoginAuthenticationRequest( $res->createRequest, + $state['maybeLink'] ); + $restartRequests[] = $createRequest; + $ret->createRequest = $createRequest; + } + $ret->neededRequests = $restartRequests; $session->set( 'AuthManager::authnState', array( 'reqs' => array(), // Will be filled in later 'primary' => null, 'primaryResponse' => null, 'secondary' => array(), - 'continueRequests' => array(), + 'continueRequests' => $restartRequests, ) + $state ); - $ret = AuthenticationResponse::newRestart( wfMessage( $msg ) ); - $ret->neededRequests = $this->getAuthenticationRequests( self::ACTION_LOGIN_CONTINUE ); - if ( $res->createRequest || $state['maybeLink'] ) { - $ret->createRequest = new CreateFromLoginAuthenticationRequest( - $res->createRequest, $state['maybeLink'] - ); - } return $ret; } diff --git a/includes/auth/AuthenticationRequest.php b/includes/auth/AuthenticationRequest.php index 83d145c..006efae 100644 --- a/includes/auth/AuthenticationRequest.php +++ b/includes/auth/AuthenticationRequest.php @@ -159,7 +159,7 @@ * and ACTION_REMOVE and for requests returned in * AuthenticationResponse::$linkRequest to create useful user interfaces. * - * @return array with the following keys: + * @return \Message[] with the following keys: * - provider: A Message identifying the service that provides * the credentials, e.g. the name of the third party authentication * service. diff --git a/includes/auth/AuthenticationResponse.php b/includes/auth/AuthenticationResponse.php index b85f378..12287e4 100644 --- a/includes/auth/AuthenticationResponse.php +++ b/includes/auth/AuthenticationResponse.php @@ -88,7 +88,7 @@ * * Returned with an AuthManager login FAIL or RESTART, this holds a request * that may be passed to AuthManager::beginCreateAccount() after setting - * its ->returnToUrl property. On a FAIL, it may also be passed to + * its ->returnToUrl property. It may also be passed to * AuthManager::beginAuthentication() to preserve state. */ public $createRequest = null; diff --git a/languages/i18n/en.json b/languages/i18n/en.json index a7a613d..e96de9b 100644 --- a/languages/i18n/en.json +++ b/languages/i18n/en.json @@ -4003,8 +4003,8 @@ "sessionprovider-nocookies": "Cookies may be disabled. Ensure you have cookies enabled and start again.", "authmanager-authn-not-in-progress": "Authentication is not in progress or session data has been lost. Please start again from the beginning.", "authmanager-authn-no-primary": "The supplied credentials could not be authenticated.", - "authmanager-authn-no-local-user": "The supplied credentials are not associated with any user on this wiki.", - "authmanager-authn-no-local-user-link": "The supplied credentials are not associated with any user on this wiki.", + "authmanager-authn-no-local-user": "The supplied credentials are valid but not associated with any user on this wiki.", + "authmanager-authn-no-local-user-link": "The supplied credentials are valid but not associated with any user on this wiki. Login in a different way, or create a new user, and you will have an option to link your previous credentials to that account.", "authmanager-authn-autocreate-failed": "Auto-creation of a local account failed: $1", "authmanager-change-not-supported": "The supplied credentials cannot be changed, as nothing would use them.", "authmanager-create-from-login": "To create your account, please fill in the fields below.", -- To view, visit https://gerrit.wikimedia.org/r/265181 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ic0c733d6f29a249ad99fd255ca03c8fd23f0ea1f Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Gergő Tisza <gti...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits