summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--actions/logout.php2
-rw-r--r--lib/openid.php29
2 files changed, 22 insertions, 9 deletions
diff --git a/actions/logout.php b/actions/logout.php
index 9cdda52d8..c4d0bd4e7 100644
--- a/actions/logout.php
+++ b/actions/logout.php
@@ -27,8 +27,8 @@ class LogoutAction extends Action {
if (!common_logged_in()) {
common_user_error(_t('Not logged in.'));
} else {
- common_set_user(NULL);
oid_clear_last();
+ common_set_user(NULL);
common_redirect(common_local_url('public'));
}
}
diff --git a/lib/openid.php b/lib/openid.php
index 8cf614bc2..b066c654d 100644
--- a/lib/openid.php
+++ b/lib/openid.php
@@ -49,21 +49,34 @@ function oid_consumer() {
}
function oid_clear_last() {
- if (oid_get_last()) {
- oid_set_last('');
- }
+ oid_set_last('');
}
function oid_set_last($openid_url) {
- global $config;
- setcookie(OPENID_COOKIE_KEY, $openid_url,
+
+ $path = common_config('site', 'path');
+ $server = common_config('site', 'server');
+
+ if ($path && ($path != '/')) {
+ $cookiepath = '/' . $path . '/';
+ } else {
+ $cookiepath = '/';
+ }
+
+ setcookie(OPENID_COOKIE_KEY,
+ $openid_url,
time() + OPENID_COOKIE_EXPIRY,
- '/' . $config['site']['path'] . '/',
- $config['site']['server']);
+ $cookiepath,
+ $server);
}
function oid_get_last() {
- return $_COOKIE[OPENID_COOKIE_KEY];
+ $openid_url = $_COOKIE[OPENID_COOKIE_KEY];
+ if ($openid_url && strlen($openid_url) > 0) {
+ return $openid_url;
+ } else {
+ return NULL;
+ }
}
function oid_link_user($id, $canonical, $display) {