Plugin: OAuth2: Improve message when user creation is not enabled - refs BT#19734

pull/4309/head
Angel Fernando Quiroz Campos 3 years ago
parent 620ef99de0
commit c9d1684fde
  1. 2
      plugin/oauth2/lang/english.php
  2. 9
      plugin/oauth2/src/OAuth2.php

@ -124,7 +124,7 @@ $strings['FailedUserCreation'] = 'User account creation failed';
$strings['InternalErrorCannotGetUserInfo'] = 'Internal error: could not get user information'; $strings['InternalErrorCannotGetUserInfo'] = 'Internal error: could not get user information';
$strings['InvalidJsonReceivedFromProvider'] = 'The OAuth2 provider did not provide a valid JSON document'; $strings['InvalidJsonReceivedFromProvider'] = 'The OAuth2 provider did not provide a valid JSON document';
$strings['ManagementLogin'] = 'Management Login'; $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['OAuth2Id'] = 'OAuth2 identifier';
$strings['UserNotAllowedOnThisPortal'] = 'This user account is not enabled on this portal'; $strings['UserNotAllowedOnThisPortal'] = 'This user account is not enabled on this portal';
$strings['WrongResponseResourceOwnerId'] = 'OAuth2 resource owner identifier value not found at the configured key'; $strings['WrongResponseResourceOwnerId'] = 'OAuth2 resource owner identifier value not found at the configured key';

@ -207,7 +207,14 @@ class OAuth2 extends Plugin
if (false === $result) { if (false === $result) {
// authenticated user not found in internal database // authenticated user not found in internal database
if ('true' !== $this->get(self::SETTING_CREATE_NEW_USERS)) { 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( $firstName = $this->getValueByKey(

Loading…
Cancel
Save