Skip to content

Commit df972ba

Browse files
Merge pull request #6252 from christianbeeznest/rna-22529-2
User: Allow admin to access intro page creation even if registration is disabled - refs BT#22529
2 parents f2bc514 + 7dc6197 commit df972ba

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

public/main/auth/inscription.php

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -119,9 +119,19 @@
119119
$htmlHeadXtra[] = api_get_password_checker_js('#username', '#pass1');
120120
// User is not allowed if Terms and Conditions are disabled and
121121
// registration is disabled too.
122-
$isNotAllowedHere = ('false' === api_get_setting('allow_terms_conditions') && 'false' === api_get_setting('allow_registration'));
123-
if ($isNotAllowedHere) {
124-
api_not_allowed(true, get_lang('Sorry, you are trying to access the registration page for this portal, but registration is currently disabled. Please contact the administrator (see contact information in the footer). If you already have an account on this site.'));
122+
$isCreatingIntroPage = isset($_GET['create_intro_page']);
123+
$isPlatformAdmin = api_is_platform_admin();
124+
125+
$isNotAllowedHere = (
126+
'false' === api_get_setting('allow_terms_conditions') &&
127+
'false' === api_get_setting('allow_registration')
128+
);
129+
130+
if ($isNotAllowedHere && !($isCreatingIntroPage && $isPlatformAdmin)) {
131+
api_not_allowed(
132+
true,
133+
get_lang('Sorry, you are trying to access the registration page for this portal, but registration is currently disabled. Please contact the administrator (see contact information in the footer). If you already have an account on this site.')
134+
);
125135
}
126136

127137
$settingConditions = api_get_setting('profile.show_conditions_to_user', true);
@@ -633,16 +643,6 @@
633643
$toolName = get_lang('Terms and Conditions');
634644
}
635645

636-
// Forbidden to self-register
637-
if ($isNotAllowedHere) {
638-
api_not_allowed(
639-
true,
640-
get_lang(
641-
'Sorry, you are trying to access the registration page for this portal, but registration is currently disabled. Please contact the administrator (see contact information in the footer). If you already have an account on this site.'
642-
)
643-
);
644-
}
645-
646646
if ('approval' === api_get_setting('allow_registration')) {
647647
$content .= Display::return_message(get_lang('Your account has to be approved'));
648648
}
@@ -658,7 +658,7 @@
658658
// Terms and conditions
659659
$infoMessage = '';
660660
if ('true' === api_get_setting('allow_terms_conditions')) {
661-
if (!api_is_platform_admin()) {
661+
if (!$isPlatformAdmin) {
662662
if ('true' === api_get_setting('ticket.show_terms_if_profile_completed')) {
663663
$userId = api_get_user_id();
664664
if (empty($userId) && isset($termRegistered['user_id'])) {
@@ -1381,7 +1381,7 @@
13811381
. '</div>' . $content;
13821382
}
13831383

1384-
if (isset($_GET['create_intro_page']) && api_is_platform_admin()) {
1384+
if ($isCreatingIntroPage && $isPlatformAdmin) {
13851385
$user = api_get_user_entity();
13861386

13871387
if ($introPage) {

0 commit comments

Comments
 (0)