Skip to content

Commit 0c8707f

Browse files
Merge pull request #7500 from christianbeeznest/GH-7459-2
User: Use registration.allow_double_validation_in_registration for double validation - refs #7459
2 parents 15a7ad5 + a1e04ff commit 0c8707f

2 files changed

Lines changed: 7 additions & 6 deletions

File tree

public/main/auth/registration.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1199,16 +1199,15 @@ function ($email) {
11991199
);
12001200
} else {
12011201
$allow = ('true' === api_get_setting('registration.allow_double_validation_in_registration'));
1202-
$termsEnabled = ('true' === api_get_setting('allow_terms_conditions'));
12031202

12041203
ChamiloHelper::addLegalTermsFields($form, $userAlreadyRegisteredShowTerms);
12051204

12061205
/**
1207-
* The "double validation" (Validate -> Register) is legacy UX.
1208-
* When Terms & Conditions are enabled, it becomes redundant and may create a confusing 2-step flow.
1209-
* Keep it only for platforms that explicitly want it without T&C.
1206+
* Double validation must be controlled ONLY by:
1207+
* registration.allow_double_validation_in_registration
1208+
* It must not depend on Terms & Conditions activation.
12101209
*/
1211-
if ($allow && !$termsEnabled && !$termActivated) {
1210+
if ($allow && !$termActivated) {
12121211
$htmlHeadXtra[] = '<script>
12131212
$(document).ready(function() {
12141213
$("#pre_validation").click(function() {
@@ -1479,6 +1478,7 @@ function ($email) {
14791478
$user['mail'] = $values['email'];
14801479
$user['language'] = $values['language'];
14811480
$user['user_id'] = $userId;
1481+
$user['id'] = $userId;
14821482
Session::write('_user', $user);
14831483

14841484
$is_allowedCreateCourse = isset($values['status']) && 1 == $values['status'];
@@ -1509,6 +1509,7 @@ function ($email) {
15091509
'mail' => $values['email'],
15101510
'language' => $values['language'],
15111511
'user_id' => $userId,
1512+
'id' => $userId,
15121513
];
15131514

15141515
$sessionHandler->set('_user', $userData);

public/main/inc/lib/course.lib.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6203,7 +6203,7 @@ public static function redirectToCourse($form_data)
62036203
{
62046204
$courseIdRedirect = Session::read('course_redirect');
62056205
$_user = api_get_user_info();
6206-
$userId = $_user['id'];
6206+
$userId = (int) ($_user['id'] ?? ($_user['user_id'] ?? 0));
62076207

62086208
if (!empty($courseIdRedirect)) {
62096209
$course_info = api_get_course_info_by_id($courseIdRedirect);

0 commit comments

Comments
 (0)