summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvan Prodromou <evan@controlezvous.ca>2008-06-23 23:10:57 -0400
committerEvan Prodromou <evan@controlezvous.ca>2008-06-23 23:10:57 -0400
commitae2603ec1327dd058b15317f46232707cd12cd95 (patch)
tree7dca3156db873da7f36172e015098337521e8650
parentb26316589cd8cba7e3243035522ebe414a58dc0c (diff)
use the correct field for Remember_me
darcs-hash:20080624031057-34904-7a2597a8f56d9d49ad8f126c55058893a922c89f.gz
-rw-r--r--lib/util.php8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/util.php b/lib/util.php
index 416f02395..5ef7f641b 100644
--- a/lib/util.php
+++ b/lib/util.php
@@ -457,13 +457,13 @@ function common_rememberme() {
}
$rm = new Remember_me();
$rm->code = common_good_rand(16);
- $rm->user = $user->id();
+ $rm->user_id = $user->id();
if (!$rm->insert()) {
common_log_db_error($rm, 'INSERT', __FILE__);
return false;
}
common_set_cookie(REMEMBERME,
- $rm->user . ':' . $rm->code,
+ $rm->user_id . ':' . $rm->code,
time() + REMEMBERME_EXPIRY);
}
@@ -475,7 +475,7 @@ function common_remembered_user() {
list($id, $code) = explode(':', $packed);
if ($id && $code) {
$rm = Remember_me::staticGet($code);
- if ($rm && $rm->id == $id) {
+ if ($rm && $rm->user_id == $id) {
$user = User::staticGet($rm->id);
if ($user) {
# successful!
@@ -486,6 +486,8 @@ function common_remembered_user() {
} else {
common_set_user($user);
common_real_login(false);
+ # We issue a new cookie, so they can log in
+ # automatically again after this session
common_rememberme();
}
}