Commit 54c37455 authored by Donal McMullan's avatar Donal McMullan
Browse files

New validate function for form

parent 8683fffc
......@@ -97,6 +97,24 @@ if ($institution && $plugin) {
$smarty->assign('auth_imap_form', pieform($form));
}
function auth_config_validate(Pieform $form, $values) {
$plugin = $values['authname'];
$classname = 'PluginAuth' . ucfirst(strtolower($plugin));
if (!method_exists($classname, 'validate_config_options')) {
return;
}
safe_require('auth', strtolower($plugin));
try {
$values = call_static_method($classname, 'validate_config_options', $values, $form);
} catch (Exception $e) {
if (!$form->has_errors()) {
$form->set_error('instancename', "An unknown error occurred while processing this form");
}
}
}
function auth_config_submit(Pieform $form, $values) {
$plugin = $values['authname'];
$classname = 'PluginAuth' . ucfirst(strtolower($plugin));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment