Skip to content

Commit

Permalink
Plugin: OAuth2: Improve message when user creation is not enabled - r…
Browse files Browse the repository at this point in the history
…efs BT#19734
  • Loading branch information
AngelFQC committed Jun 2, 2022
1 parent 620ef99 commit c9d1684
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion plugin/oauth2/lang/english.php
Expand Up @@ -124,7 +124,7 @@
$strings['InternalErrorCannotGetUserInfo'] = 'Internal error: could not get user information';
$strings['InvalidJsonReceivedFromProvider'] = 'The OAuth2 provider did not provide a valid JSON document';
$strings['ManagementLogin'] = 'Management Login';
$strings['NoUserHasThisOauthCode'] = 'No existing user has this OAuth2 code';
$strings['NoUserAccountAndUserCreationNotAllowed'] = 'This user doesn\'t have an account yet and auto-provisioning is not enabled. Please contact this portal administration team at %s to request access.';
$strings['OAuth2Id'] = 'OAuth2 identifier';
$strings['UserNotAllowedOnThisPortal'] = 'This user account is not enabled on this portal';
$strings['WrongResponseResourceOwnerId'] = 'OAuth2 resource owner identifier value not found at the configured key';
Expand Down
9 changes: 8 additions & 1 deletion plugin/oauth2/src/OAuth2.php
Expand Up @@ -207,7 +207,14 @@ public function getUserInfo(GenericProvider $provider, AccessToken $accessToken)
if (false === $result) {
// authenticated user not found in internal database
if ('true' !== $this->get(self::SETTING_CREATE_NEW_USERS)) {
throw new RuntimeException($this->get_lang('NoUserHasThisOauthCode'));
throw new RuntimeException(
sprintf(
$this->get_lang('NoUserAccountAndUserCreationNotAllowed'),
Display::encrypted_mailto_link(
api_get_setting('emailAdministrator')
)
)
);
}

$firstName = $this->getValueByKey(
Expand Down

0 comments on commit c9d1684

Please sign in to comment.