From 9b0724bf5651828e061336d16d673d20c844eb02 Mon Sep 17 00:00:00 2001 From: Dominique Fournier Date: Thu, 1 Sep 2016 11:02:42 +0000 Subject: [PATCH] auth* : the details can be provided in all the cases : if the user is authenticated, at least, return the email git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@3019 bf3deb0d-5f1a-0410-827f-c0cc1f45334c --- authimap.php | 7 +++++-- authsympa.php | 7 +++---- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/authimap.php b/authimap.php index c7b48ee..b0e228a 100644 --- a/authimap.php +++ b/authimap.php @@ -18,6 +18,9 @@ class authimap extends auth /** IMAP SSL CheckCertificate */ public $imapSSLCheckCertificates = true; + /** The details available after authentication */ + private $details = null; + /** Check the availablity of the IMAP support in PHP */ function __construct () { @@ -40,6 +43,7 @@ class authimap extends auth $imap = new imap ($this->imapServer, $this->imapPort, $email, $password, $this->imapSSL, $this->imapSSLCheckCertificates); + $this->details = array ("email"=>$email); // Let the throw Exception be catched by the parent return true; } @@ -47,8 +51,7 @@ class authimap extends auth /** Return all the parameters recorded for the authenticate user */ public function getdetails () { - throw new Exception (dgettext("domframework", - "Can't get details for IMAP users"), 405); + return $this->details; } /** Method to change the password diff --git a/authsympa.php b/authsympa.php index da85ebb..79e3d46 100644 --- a/authsympa.php +++ b/authsympa.php @@ -35,7 +35,7 @@ class authsympa extends auth /** Temporary auth key used betwwen commands */ private $authkey = null; /** Email of the user if the authentication is correct */ - private $email = null; + private $details = null; /** Check if the SOAP module is available in PHP */ public function __construct () @@ -70,19 +70,18 @@ class authsympa extends auth throw new Exception (dgettext("domframework", "Can't connect with provided email/password to sympa"), 401); - $this->email = $email; $rc = $this->client->authenticateAndRun ($email, $this->authkey, 'amI', array ($this->list, $this->function, $email)); if ($rc === null) return FALSE; + $this->details = array ("email"=>$email); return $rc; } /** Return all the parameters recorded for the authenticate user */ public function getdetails () { - throw new Exception (dgettext("domframework", - "The details can't be provided by Sympa"), 404); + return $this->details; } /** Method to change the password