Commit 8c078318 authored by Nigel McNie's avatar Nigel McNie
Browse files

A couple of form handling improvements for the authorities popup:

 * Ensure we redirect after processing the addauthority form, as is required by Pieforms.
 * Make sure the error message, if there is one (and there shouldn't be because validation should have taken care of it), goes to the session messages rather than on a form element that might not exist.
parent de333a45
......@@ -116,13 +116,17 @@ function auth_config_validate(Pieform $form, $values) {
}
function auth_config_submit(Pieform $form, $values) {
global $SESSION;
$plugin = $values['authname'];
$classname = 'PluginAuth' . ucfirst(strtolower($plugin));
safe_require('auth', strtolower($plugin));
try {
$values = call_static_method($classname, 'save_config_options', $values, $form);
} catch (Exception $e) {
$form->set_error('instancename', "An unknown error occurred while processing this form");
log_info($e->getMessage());
log_info($e->getTrace());
$SESSION->add_error_msg("An error occurred while processing this form: " . $e->getMessage());
redirect($_SERVER['REQUEST_URI']);
}
if (false == $form->has_errors()) {
......@@ -133,6 +137,7 @@ function auth_config_submit(Pieform $form, $values) {
}
exit;
}
redirect($_SERVER['REQUEST_URI']);
}
// TODO: move to lib if people want this:
......
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