cvs: pear /Auth Auth.php package.xml

From: Date: Mon, 08 Sep 2003 11:51:59 +0000
Subject: cvs: pear /Auth Auth.php package.xml
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-12540@lists.php.net to get a copy of this message
yavo Mon Sep 8 07:51:59 2003 EDT Modified files: /pear/Auth Auth.php package.xml Log: Added a new callback loginFailedCallback, to be called on an unsuccessful login All callbacks get a second parameter a reference to the auth object Index: pear/Auth/Auth.php diff -u pear/Auth/Auth.php:1.61 pear/Auth/Auth.php:1.62 --- pear/Auth/Auth.php:1.61 Sat Aug 30 17:15:28 2003 +++ pear/Auth/Auth.php Mon Sep 8 07:51:59 2003 @@ -16,7 +16,7 @@ // | Authors: Martin Jansen <mj@php.net> | // +----------------------------------------------------------------------+ // -// $Id: Auth.php,v 1.61 2003/08/30 21:15:28 yavo Exp $ +// $Id: Auth.php,v 1.62 2003/09/08 11:51:59 yavo Exp $ // require_once "PEAR.php"; @@ -33,7 +33,7 @@ * * @author Martin Jansen <mj@php.net> * @package Auth - * @version $Revision: 1.61 $ + * @version $Revision: 1.62 $ */ class Auth { @@ -128,6 +128,14 @@ var $loginCallback = ""; /** + * Failed Login callback function name + * + * @var string + * @see setLoginFailedCallback() + */ + var $loginFailedCallback = ""; + + /** * Logout callback function name * * @var string @@ -275,13 +283,17 @@ if (!empty($this->username)) { if (true === $this->storage->fetchData($this->username, $this->password)) { $login_ok = true; + } else { + if (!empty($this->loginFailedCallback)) { + call_user_func($this->loginFailedCallback,$this->username, &$this); + } } } if (!empty($this->username) && $login_ok) { $this->setAuth($this->username); if (!empty($this->loginCallback)) { - call_user_func($this->loginCallback,$this->username); + call_user_func($this->loginCallback,$this->username, &$this); } } @@ -375,7 +387,7 @@ /** * Register a callback function to be called on user login. - * The function will receive a single parameter, the username. + * The function will receive two parameters, the username and a reference to the auth object. * * @access public * @param string callback function name @@ -388,8 +400,21 @@ } /** + * Register a callback function to be called on failed user login. + * The function will receive a single parameter, the username and a reference to the auth object. + * + * @access public + * @param string callback function name + * @return void + */ + function setFailedLoginCallback($loginFailedCallback) + { + $this->loginFailedCallback = $loginFailedCallback; + } + + /** * Register a callback function to be called on user logout. - * The function will receive a single parameter, the username. + * The function will receive three parameters, the username and a reference to the auth object. * * @access public * @param string callback function name @@ -584,7 +609,7 @@ function drawLogin($username = "") { if ($this->loginFunction != "") { - call_user_func($this->loginFunction, $username, $this->status); + call_user_func($this->loginFunction, $username, $this->status, &$this); } else { $server = &$this->_importGlobalVariable("server"); @@ -640,7 +665,7 @@ $session = &$this->_importGlobalVariable("session"); if (!empty($this->logoutCallback)) { - call_user_func($this->logoutCallback, $session[$this->_sessionName]['username']); + call_user_func($this->logoutCallback, $session[$this->_sessionName]['username'], &$this); } $this->username = ""; Index: pear/Auth/package.xml diff -u pear/Auth/package.xml:1.31 pear/Auth/package.xml:1.32 --- pear/Auth/package.xml:1.31 Mon Sep 8 07:25:35 2003 +++ pear/Auth/package.xml Mon Sep 8 07:51:59 2003 @@ -41,11 +41,14 @@ </maintainers> <release> <version>1.2.3</version> - <date>2003-xx-xx</date> + <date>2003-09-08</date> <license>PHP License</license> <state>stable</state> <notes> <![CDATA[ +* Login/Logout callbacks now get a reference to auth +* New Login Failed Callback added (method setFailedLoginCallback) +* SOAP container patch to keep a reference to the Soap responce by Bruno Pedro <bpedro@co.sapo.pt> * Auth is now installed in /pear-dir/Auth.php instead of /pear-dir/Auth/Auth.php, an empty file /pear-dev/Auth/Auth.php wich includes Auth.php is added for BC * The contaner now gets a reference to the auth object ($auth->storage->_auth_obj)

« previous php.pear.cvs (#12540) next »