fix bloquage clé incorrecte

This commit is contained in:
Fred Tempez 2023-10-17 11:21:35 +02:00
parent 6b840ecaa9
commit a025d33ab8

View File

@ -658,10 +658,17 @@ class course extends common
$_SESSION['ZWII_SITE_CONTENT'] = $courseId; $_SESSION['ZWII_SITE_CONTENT'] = $courseId;
break; break;
case self::COURSE_ENROLMENT_SELF_KEY: case self::COURSE_ENROLMENT_SELF_KEY:
if ($this->getInput('courseSwapEnrolmentKey') === $this->getData(['course', $courseId, 'enrolmentKey'])) { if ($this->getInput('courseSwapEnrolmentKey', null, true) === $this->getData(['course', $courseId, 'enrolmentKey'])) {
$this->courseEnrolUser($courseId, $userId); $this->courseEnrolUser($courseId, $userId);
// Stocker la sélection // Stocker la sélection
$_SESSION['ZWII_SITE_CONTENT'] = $courseId; $_SESSION['ZWII_SITE_CONTENT'] = $courseId;
} else {
// Valeurs en sortie
$this->addOutput([
'redirect' => helper::baseUrl(),
'state' => false,
'notification' => 'La clé est incorrecte'
]);
} }
break; break;
} }
@ -784,7 +791,8 @@ class course extends common
} }
} }
private function countPages($array) { private function countPages($array)
{
$count = 0; $count = 0;
foreach ($array as $key => $value) { foreach ($array as $key => $value) {
$count++; // Incrémente le compteur pour chaque clé associative trouvée $count++; // Incrémente le compteur pour chaque clé associative trouvée