Permalink
Browse files

MDL-30398 Validations added for password field

  • Loading branch information...
1 parent 79b0fec commit 7b5abb50ce5f895ae26d57c094232a1c59ef8e09 @ankitagarwal ankitagarwal committed Nov 22, 2011
Showing with 4 additions and 0 deletions.
  1. +1 −0 mod/lesson/lang/en/lesson.php
  2. +3 −0 mod/lesson/mod_form.php
@@ -158,6 +158,7 @@
$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';
View
@@ -339,6 +339,9 @@ function validation($data, $files) {
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;
}

0 comments on commit 7b5abb5

Please sign in to comment.