Permalink
Browse files

auth: extend API to support auth_validate_form()

Now Auth plugins can register auth_validate_form to get a chance
to validate config form input. Needed on MOODLE_16_STABLE to fix
a bug with auth/db.

The auth API must follow suit with the enrol API, where we can safely
do method_exists().
  • Loading branch information...
1 parent 2d4fb02 commit 1590773b1c6c2edfa9935ee992271569874f98e1 martinlanghoff committed Jul 18, 2006
Showing with 16 additions and 9 deletions.
  1. +8 −9 admin/auth.php
  2. +8 −0 auth/README
View
@@ -26,7 +26,6 @@
if ($config = data_submitted()) {
$config = (array)$config;
- validate_form($config, $err);
// extract and sanitize the auth key explicitly
$modules = get_list_of_plugins("auth");
@@ -36,6 +35,14 @@
notify("Error defining the authentication method");
}
+ // load the auth plugin library
+ require_once("{$CFG->dirroot}/auth/$auth/lib.php");
+
+ $err = array();
+ if (function_exists('auth_validate_form')) {
+ auth_validate_form($config, $err);
+ }
+
if (count($err) == 0) {
foreach ($config as $name => $value) {
if (preg_match('/^pluginconfig_(.+?)$/', $name, $matches)) {
@@ -233,14 +240,6 @@
/// Functions /////////////////////////////////////////////////////////////////
-function validate_form(&$form, &$err) {
-
- // if (empty($form->fullname))
- // $err["fullname"] = get_string("missingsitename");
-
- return;
-}
-
//
// Good enough for most auth plugins
// but some may want a custom one if they are offering
View
@@ -121,6 +121,14 @@ Optional:
Userinformation in array ( name => value, ....
or false in case of error
+ auth_validate_form(&$form, &$err)
+
+ Validate form data.
+
+ Returns:
+ Bool. Manipulates $form and $err arrays in place
+
+
COURSE CREATING
auth_iscreator($username)

0 comments on commit 1590773

Please sign in to comment.