Skip to content
Snippets Groups Projects
Commit d6b8832a authored by David Siegfried's avatar David Siegfried
Browse files

fix password-validation, closes #741

Closes #741

Merge request studip/studip!605
parent cd8d4990
No related branches found
No related tags found
No related merge requests found
...@@ -405,6 +405,7 @@ class Course_AdmissionController extends AuthenticatedController ...@@ -405,6 +405,7 @@ class Course_AdmissionController extends AuthenticatedController
$rule_types = AdmissionRule::getAvailableAdmissionRules(true); $rule_types = AdmissionRule::getAvailableAdmissionRules(true);
if (isset($rule_types[$type])) { if (isset($rule_types[$type])) {
$rule = new $type($rule_id); $rule = new $type($rule_id);
$another_rule = null;
if (isset($rule_types[$another_type])) { if (isset($rule_types[$another_type])) {
$another_rule = new $another_type($another_rule_id); $another_rule = new $another_type($another_rule_id);
} }
...@@ -418,11 +419,16 @@ class Course_AdmissionController extends AuthenticatedController ...@@ -418,11 +419,16 @@ class Course_AdmissionController extends AuthenticatedController
return; return;
} else { } else {
CSRFProtection::verifyUnsafeRequest(); CSRFProtection::verifyUnsafeRequest();
$rule->setAllData(Request::getInstance());
$errors = $rule->validate(Request::getInstance()); $errors = $rule->validate(Request::getInstance());
if (empty($errors)) {
$rule->setAllData(Request::getInstance());
}
if ($another_rule) { if ($another_rule) {
$another_rule->setAllData(Request::getInstance()); $another_errors = $another_rule->validate(Request::getInstance());
$errors = array_merge($errors, $another_rule->validate(Request::getInstance())); if (empty($another_errors)) {
$another_rule->setAllData(Request::getInstance());
}
$errors = array_merge($errors, $another_errors);
} }
if (!mb_strlen(trim(Request::get('instant_course_set_name')))) { if (!mb_strlen(trim(Request::get('instant_course_set_name')))) {
$errors[] = _("Bitte geben Sie einen Namen für die Anmelderegel ein!"); $errors[] = _("Bitte geben Sie einen Namen für die Anmelderegel ein!");
......
...@@ -140,7 +140,7 @@ class PasswordAdmission extends AdmissionRule ...@@ -140,7 +140,7 @@ class PasswordAdmission extends AdmissionRule
* *
* @param String userId * @param String userId
* @param String courseId * @param String courseId
* @return Boolean * @return array
*/ */
public function ruleApplies($userId, $courseId) public function ruleApplies($userId, $courseId)
{ {
...@@ -235,7 +235,4 @@ class PasswordAdmission extends AdmissionRule ...@@ -235,7 +235,4 @@ class PasswordAdmission extends AdmissionRule
} }
return $errors; return $errors;
} }
}
} /* end of class PasswordAdmission */
?>
<h3><?= htmlReady($rule->getName()) ?></h3> <h3><?= htmlReady($rule->getName()) ?></h3>
<label for="message" class="caption"> <label>
<?= _('Nachricht bei fehlgeschlagener Anmeldung') ?>: <?= _('Nachricht bei fehlgeschlagener Anmeldung') ?>:
<textarea name="message" rows="4" cols="50"><?= htmlReady($rule->getMessage()) ?></textarea>
</label> </label>
<textarea name="message" rows="4" cols="50"><?= $rule->getMessage() ?></textarea> <label>
<br/>
<label for="password1" class="caption">
<?= _('Zugangspasswort') ?>: <?= _('Zugangspasswort') ?>:
<input type="password" name="password1" size="25" max="40" value="<?= htmlReady($rule->getPassword()) ?>" required>
</label> </label>
<input type="password" name="password1" size="25" max="40" value="<?= htmlReady($rule->getPassword()) ?>" required/>
<br/> <br/>
<label for="password2" class="caption"> <label>
<?= _('Passwort wiederholen') ?>: <?= _('Passwort wiederholen') ?>:
<input type="password" name="password2" size="25" max="40" value="<?= htmlReady($rule->getPassword()) ?>" required>
</label> </label>
<input type="password" name="password2" size="25" max="40" value="<?= htmlReady($rule->getPassword()) ?>" required/>
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment