Home > Archive > PHP Pear > March 2006 > Re: [PEAR] Auth "remember me"
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Re: [PEAR] Auth "remember me"
|
|
| Adam Ashley 2006-03-19, 6:57 pm |
| On Sat, 2006-03-18 at 11:38 +0100, Alessandro Pasotti wrote:
> Hello,
>
> Does anybody knows about a tutorial, manual, link or info about adding the
> "remember me" functionality to a system using PEAR::Auth?
>
>
> Many thanks.
>
use Auth::setExpire() and Auth::setIdle() to long time periods to allow
the login session to last as long as you like.
To get the login box to remember the username build your own custom
login page that pulls the last used login name from a cookie.
Adam Ashley
| |
| Alessandro Pasotti 2006-03-20, 7:56 am |
| Il 00:54, luned=EC 20 marzo 2006, Adam Ashley ha scritto:
> On Sat, 2006-03-18 at 11:38 +0100, Alessandro Pasotti wrote:
> use Auth::setExpire() and Auth::setIdle() to long time periods to allow
> the login session to last as long as you like.
>
> To get the login box to remember the username build your own custom
> login page that pulls the last used login name from a cookie.
Thanks Adam,
This is what I did additionally to your suggestions (in case anybody else n=
eed=20
it):
Add a method to subclassed Auth_Container:
function _setAuthCookie($username, $password){
setcookie('username', $username, time()+60*60*24*30);
setcookie('password', $password, time()+60*60*24*30);
}
[...]
in fetchData: if access is granted,
if(isset($_REQUEST['remember_me'])){
$this->_setAuthCookie($username, $password);
}
Add a method to subclassed Auth:
function assignData() {
if($_COOKIE['username']) {
$this->post[$this->_postUsername] =3D $_COOKIE['username'];
}
if($_COOKIE['password']) {
$this->post[$this->_postPassword] =3D $_COOKIE['password'];
}
parent::assignData();
}
=2D-=20
Alessandro Pasotti
w3 www.itopen.it
Linux User #167502
|
|
|
|
|