diff options
author | Martin Fischer <martin@push-f.com> | 2022-10-13 10:17:51 +0200 |
---|---|---|
committer | Martin Fischer <martin@push-f.com> | 2022-10-13 10:21:37 +0200 |
commit | 46a49fbb9d856452580e8ff07185a500ab4861f6 (patch) | |
tree | 08fa621542b8be50f5c367af4cc94a7acbf50b30 | |
parent | 640f5d2faa3ce1319d9faed0993597b1deaf8b3c (diff) |
Previously we treated the case that a configured ProviderDetails
returned an invalid username as an irrecoverable error but it makes
more sense to just instead ask the user to pick a different username.
-rw-r--r-- | RedirectAuth.php | 12 | ||||
-rw-r--r-- | i18n/en.json | 1 |
2 files changed, 4 insertions, 9 deletions
diff --git a/RedirectAuth.php b/RedirectAuth.php index cd73e19..0d09f3d 100644 --- a/RedirectAuth.php +++ b/RedirectAuth.php @@ -214,19 +214,15 @@ class RedirectAuthProvider extends AbstractPrimaryAuthenticationProvider { // The external user id has not yet been linked to a wiki account. $user = $userFactory->newFromName($userInfo->userName, UserFactory::RIGOR_CREATABLE); - if ($req instanceof OtherUsernameAuthRequest) { - if ($user == null) { - return AuthenticationResponse::newUI([new OtherUsernameAuthRequest($userInfo)], WfMessage('redirectauth-pick-other-username-invalid')); - } else if ($user->isRegistered()) { - return AuthenticationResponse::newUI([new OtherUsernameAuthRequest($userInfo)], WfMessage('redirectauth-pick-other-username-taken', $userInfo->userName)); - } - } if ($user == null) { - return AuthenticationResponse::newFail(wfMessage('redirectauth-error-invalid-username', 'ProviderDetails')); + return AuthenticationResponse::newUI([new OtherUsernameAuthRequest($userInfo)], WfMessage('redirectauth-pick-other-username-invalid')); } if ($user->isRegistered()) { // namespace collision + if ($req instanceof OtherUsernameAuthRequest) { + return AuthenticationResponse::newUI([new OtherUsernameAuthRequest($userInfo)], WfMessage('redirectauth-pick-other-username-taken', $userInfo->userName)); + } // We create the link manually because if the system message contained [[User:$1|]] MediaWiki would create an // action=edit link in case the user page doesn't exist ... and linking an edit page would be confusing. diff --git a/i18n/en.json b/i18n/en.json index 7e5f74a..76bd20a 100644 --- a/i18n/en.json +++ b/i18n/en.json @@ -13,7 +13,6 @@ "redirectauth-collision-opt-create": "Create a new differently named account", "redirectauth-pick-other-username-taken": "The username $1 is already taken, please choose another username", "redirectauth-pick-other-username-invalid": "That username is invalid, please choose another username", - "redirectauth-error-invalid-username": "The configured $1 returned an invalid username", "redirectauth-linked-account": "Linked account:", "redirectauth-link-your": "Link your $1 account", "redirectauth-unlink-your": "Unlink your $1 account", |