diff --git a/mod/lesson/lang/en/lesson.php b/mod/lesson/lang/en/lesson.php index a8201a9ab61..93c921bab55 100644 --- a/mod/lesson/lang/en/lesson.php +++ b/mod/lesson/lang/en/lesson.php @@ -158,6 +158,7 @@ $string['endoflesson'] = 'End of lesson'; $string['enteredthis'] = 'entered this.'; $string['entername'] = 'Enter a nickname for the high scores list'; $string['enterpassword'] = 'Please enter the password:'; +$string['emptypassword'] = 'Password cannot be empty'; $string['eolstudentoutoftime'] = 'Attention: You ran out of time for this lesson. Your last answer may not have counted if it was answered after the time was up.'; $string['eolstudentoutoftimenoanswers'] = 'You did not answer any questions. You have received a 0 for this lesson.'; $string['essay'] = 'Essay'; diff --git a/mod/lesson/mod_form.php b/mod/lesson/mod_form.php index b0dbfa7f15d..3b2f1a20a71 100644 --- a/mod/lesson/mod_form.php +++ b/mod/lesson/mod_form.php @@ -339,6 +339,9 @@ class mod_lesson_mod_form extends moodleform_mod { if (empty($data['maxtime']) and !empty($data['timed'])) { $errors['timedgrp'] = get_string('err_numeric', 'form'); } + if (!empty($data['usepassword']) && empty($data['password'])) { + $errors['password'] = get_string('emptypassword', 'lesson'); + } return $errors; }