Re: Auth "remember me"

From: Date: Mon, 20 Mar 2006 13:18:49 +0000
Subject: Re: Auth "remember me"
References: 1 2  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-23350@lists.php.net to get a copy of this message
Il 00:54, lunedì 20 marzo 2006, Adam Ashley ha scritto: > 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? > 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 need 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] = $_COOKIE['username']; } if($_COOKIE['password']) { $this->post[$this->_postPassword] = $_COOKIE['password']; } parent::assignData(); } -- Alessandro Pasotti w3 www.itopen.it Linux User #167502

« previous php.pear.general (#23350) next »