diff options
author | David Mudrák <david@moodle.com> | 2017-09-28 16:18:13 +0200 |
---|---|---|
committer | David Mudrák <david@moodle.com> | 2017-09-28 16:18:13 +0200 |
commit | 88c5965d4c24cc82480ec3c99c966eb44ad27075 (patch) | |
tree | 4c2bdbfff5417c435e1117c379c576d140dff3a5 /MoodlePasswordPrimaryAuthenticationProvider.php | |
parent | 094f33e4991abe05b4640bffa79426870fd97dad (diff) | |
download | AuthMinetest-88c5965d4c24cc82480ec3c99c966eb44ad27075.tar.gz AuthMinetest-88c5965d4c24cc82480ec3c99c966eb44ad27075.tar.bz2 AuthMinetest-88c5965d4c24cc82480ec3c99c966eb44ad27075.zip |
Add remote exceptions handling
Diffstat (limited to 'MoodlePasswordPrimaryAuthenticationProvider.php')
-rw-r--r-- | MoodlePasswordPrimaryAuthenticationProvider.php | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/MoodlePasswordPrimaryAuthenticationProvider.php b/MoodlePasswordPrimaryAuthenticationProvider.php index 212c6bf..75c9bef 100644 --- a/MoodlePasswordPrimaryAuthenticationProvider.php +++ b/MoodlePasswordPrimaryAuthenticationProvider.php @@ -146,6 +146,10 @@ class MoodlePasswordPrimaryAuthenticationProvider extends AbstractPrimaryAuthent if ( !empty( $decoded->token ) ) { return $decoded->token; + } else if ( isset( $decoded->exception ) ) { + $this->logger->error( 'AuthMoodle: Remote exception: '.$decoded->exception ); + return false; + } else if ( isset( $decoded->error ) ) { $this->logger->error( 'AuthMoodle: Remote error: '.$decoded->error ); return false; @@ -256,6 +260,11 @@ class MoodlePasswordPrimaryAuthenticationProvider extends AbstractPrimaryAuthent return false; } + if ( isset( $decoded->exception ) ) { + $this->logger->error( 'AuthMoodle: Remote exception: '.$decoded->exception ); + return false; + } + return (object) [ 'fullname' => $decoded[0]->fullname, 'email' => $decoded[0]->email, |