[lux commit] r115 - trunk/Lux/Auth/Adapter

0 views
Skip to first unread message

codesite...@google.com

unread,
Mar 2, 2008, 8:42:43 PM3/2/08
to lux...@googlegroups.com
Author: rodrigo.moraes
Date: Sun Mar 2 17:42:32 2008
New Revision: 115

Modified:
trunk/Lux/Auth/Adapter/Psql.php

Log:
There are *two* timeouts to set: one is for the cookie and the other is
to renew the token. So the 'cookie_expire' config key was added back.
The cookie timeout can be really long because the cookie will be
renewed automagically when the token timeout expires.

Modified: trunk/Lux/Auth/Adapter/Psql.php
==============================================================================
--- trunk/Lux/Auth/Adapter/Psql.php (original)
+++ trunk/Lux/Auth/Adapter/Psql.php Sun Mar 2 17:42:32 2008
@@ -48,6 +48,10 @@
* `cookie_name`
* : (string) Name of the cookie.
*
+ * `cookie_expire`
+ * : (int) Expiration time for the cookie, in seconds. Default is 2592000
+ * (one week).
+ *
* `cookie_path`
* : (string) Path option for setcookie().
*
@@ -259,7 +263,7 @@
// generate secret token
$token = md5(uniqid(rand(), true));

- // set timeout timestamp (in seconds)
+ // set timeout timestamp for the token (in seconds)
$timeout = time() + $this->_config['timeout'];

// update table info
@@ -278,7 +282,7 @@
setcookie(
$this->_config['cookie_name'],
"$identifier:$token",
- $timeout,
+ time() + $this->_config['cookie_expire'],
$this->_config['cookie_path'],
$this->_config['cookie_domain'],
$this->_config['cookie_secure'],

Reply all
Reply to author
Forward
0 new messages