Permalink
Browse files

Merge branch 'MDL-64010-master' of git://github.com/abgreeve/moodle

  • Loading branch information...
dmonllao committed Nov 19, 2018
2 parents c47fea4 + 347b771 commit dd2d82e55c1a1ac23309d7f7e7875a6033426b23
Showing with 25 additions and 0 deletions.
  1. +15 −0 badges/competency_form.php
  2. +4 −0 badges/edit_form.php
  3. +6 −0 badges/endorsement_form.php
@@ -76,4 +76,19 @@ public function definition() {
}
}
}
/**
* Validate the data from the form.
*
* @param array $data form data
* @param array $files form files
* @return array An array of error messages.
*/
public function validation($data, $files) {
$errors = parent::validation($data, $files);
if (!empty($data['targeturl']) && !preg_match('@^https?://.+@', $data['targeturl'])) {
$errors['targeturl'] = get_string('invalidurl', 'badges');
}
return $errors;
}
}
@@ -211,6 +211,10 @@ public function validation($data, $files) {
$errors['name'] = get_string('error:duplicatename', 'badges');
}
if ($data['imageauthorurl'] && !preg_match('@^https?://.+@', $data['imageauthorurl'])) {
$errors['imageauthorurl'] = get_string('invalidurl', 'badges');
}
return $errors;
}
}
@@ -86,6 +86,12 @@ public function validation($data, $files) {
if ($data['issueremail'] && !validate_email($data['issueremail'])) {
$errors['issueremail'] = get_string('invalidemail');
}
if ($data['issuerurl'] && !preg_match('@^https?://.+@', $data['issuerurl'])) {
$errors['issuerurl'] = get_string('invalidurl', 'badges');
}
if ($data['claimid'] && !preg_match('@^https?://.+@', $data['claimid'])) {
$errors['claimid'] = get_string('invalidurl', 'badges');
}
return $errors;
}
}

0 comments on commit dd2d82e

Please sign in to comment.