Commit edfcdf07 authored by Donal McMullan's avatar Donal McMullan
Browse files

Better error handling for failure to retrieve key from peer

parent 2b3d2cb3
...@@ -591,6 +591,14 @@ class PluginAuthXmlrpc extends PluginAuth { ...@@ -591,6 +591,14 @@ class PluginAuthXmlrpc extends PluginAuth {
$authinstance = new stdClass(); $authinstance = new stdClass();
$peer = new Peer(); $peer = new Peer();
if (false == $peer->findByWwwroot($values['wwwroot'])) {
try {
$peer->bootstrap($values['wwwroot'], null, $values['appname'], $values['institution']);
} catch (RemoteServerException $e) {
$form->set_error('wwwroot',get_string('cantretrievekey', 'auth'));
}
}
//TODO: test values and set appropriate errors on form //TODO: test values and set appropriate errors on form
} }
......
...@@ -217,6 +217,8 @@ class Peer { ...@@ -217,6 +217,8 @@ class Peer {
$errcode = $e->getCode(); $errcode = $e->getCode();
if ($errcode == 404) { if ($errcode == 404) {
throw new RemoteServerException('404: Incorrect WWWRoot or Application: file not found.'); throw new RemoteServerException('404: Incorrect WWWRoot or Application: file not found.');
} elseif($errcode == 704) {
throw new RemoteServerException('Networking is disabled on the host at '.$this->wwwroot.'.');
} }
} catch (Exception $e) { } catch (Exception $e) {
throw new RemoteServerException('Error retrieving public key '); throw new RemoteServerException('Error retrieving public key ');
......
Supports Markdown
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