]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
try to clear openid url cookie better
authorEvan Prodromou <evan@prodromou.name>
Thu, 19 Jun 2008 18:32:38 +0000 (14:32 -0400)
committerEvan Prodromou <evan@prodromou.name>
Thu, 19 Jun 2008 18:32:38 +0000 (14:32 -0400)
darcs-hash:20080619183238-84dde-dbe912a40894ec7414e6d5ea0bc40ec527385436.gz

actions/logout.php
lib/openid.php

index 9cdda52d84f4aa1a66540e5fdeb6f612fa442380..c4d0bd4e7aac92587e5b90aa6c0376b61a3aafcd 100644 (file)
@@ -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'));
                }
        }
index 8cf614bc26cb6bcec05644da2181445bf315ded1..b066c654db4a6295da0069c63a17a918e99026cd 100644 (file)
@@ -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) {