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
This commit is contained in:
2016-09-01 11:02:42 +00:00
parent 276f97836c
commit 9b0724bf56
2 changed files with 8 additions and 6 deletions

View File

@@ -18,6 +18,9 @@ class authimap extends auth
/** IMAP SSL CheckCertificate */ /** IMAP SSL CheckCertificate */
public $imapSSLCheckCertificates = true; public $imapSSLCheckCertificates = true;
/** The details available after authentication */
private $details = null;
/** Check the availablity of the IMAP support in PHP */ /** Check the availablity of the IMAP support in PHP */
function __construct () function __construct ()
{ {
@@ -40,6 +43,7 @@ class authimap extends auth
$imap = new imap ($this->imapServer, $this->imapPort, $imap = new imap ($this->imapServer, $this->imapPort,
$email, $password, $email, $password,
$this->imapSSL, $this->imapSSLCheckCertificates); $this->imapSSL, $this->imapSSLCheckCertificates);
$this->details = array ("email"=>$email);
// Let the throw Exception be catched by the parent // Let the throw Exception be catched by the parent
return true; return true;
} }
@@ -47,8 +51,7 @@ class authimap extends auth
/** Return all the parameters recorded for the authenticate user */ /** Return all the parameters recorded for the authenticate user */
public function getdetails () public function getdetails ()
{ {
throw new Exception (dgettext("domframework", return $this->details;
"Can't get details for IMAP users"), 405);
} }
/** Method to change the password /** Method to change the password

View File

@@ -35,7 +35,7 @@ class authsympa extends auth
/** Temporary auth key used betwwen commands */ /** Temporary auth key used betwwen commands */
private $authkey = null; private $authkey = null;
/** Email of the user if the authentication is correct */ /** Email of the user if the authentication is correct */
private $email = null; private $details = null;
/** Check if the SOAP module is available in PHP */ /** Check if the SOAP module is available in PHP */
public function __construct () public function __construct ()
@@ -70,19 +70,18 @@ class authsympa extends auth
throw new Exception (dgettext("domframework", throw new Exception (dgettext("domframework",
"Can't connect with provided email/password to sympa"), "Can't connect with provided email/password to sympa"),
401); 401);
$this->email = $email;
$rc = $this->client->authenticateAndRun ($email, $this->authkey, $rc = $this->client->authenticateAndRun ($email, $this->authkey,
'amI', array ($this->list, $this->function, $email)); 'amI', array ($this->list, $this->function, $email));
if ($rc === null) if ($rc === null)
return FALSE; return FALSE;
$this->details = array ("email"=>$email);
return $rc; return $rc;
} }
/** Return all the parameters recorded for the authenticate user */ /** Return all the parameters recorded for the authenticate user */
public function getdetails () public function getdetails ()
{ {
throw new Exception (dgettext("domframework", return $this->details;
"The details can't be provided by Sympa"), 404);
} }
/** Method to change the password /** Method to change the password