]> git.proxmox.com Git - pve-manager.git/commitdiff
fix bug #86: correctly decode cookie
authorDietmar Maurer <dietmar@proxmox.com>
Tue, 17 Jan 2012 07:18:13 +0000 (08:18 +0100)
committerDietmar Maurer <dietmar@proxmox.com>
Tue, 17 Jan 2012 07:18:13 +0000 (08:18 +0100)
PVE/REST.pm
debian/changelog.Debian
www/manager/Workspace.js

index cf50e20307b1f8e37274cd3d2f5a9662df473960..911ba096b5da6ae1b6d4ad66a4fc6091d36b11cc 100644 (file)
@@ -18,6 +18,7 @@ use HTML::Entities;
 use PVE::JSONSchema;
 use PVE::AccessControl;
 use PVE::RPCEnvironment;
+use URI::Escape;
 
 use Data::Dumper; # fixme: remove
 
@@ -44,7 +45,13 @@ sub extract_auth_cookie {
 
     return undef if !$cookie;
 
-    return ($cookie =~ /(?:^|\s)$cookie_name=([^;]*)/)[0];
+    my $ticket = ($cookie =~ /(?:^|\s)$cookie_name=([^;]*)/)[0];
+
+    if ($ticket && $ticket =~ m/^PVE%3A/) {
+       $ticket = uri_unescape($ticket);
+    }
+
+    return $ticket;
 }
 
 sub create_auth_cookie {
index 380256f553352b72f46e8022484ebdf17cc3a6bd..1d333774b6c3b6a63063955332d9b52f1f14814a 100644 (file)
@@ -2,6 +2,8 @@ pve-manager (2.0-20) unstable; urgency=low
 
   * fix bug #85: allow root@pam to generate tickets for other users
 
+  * fix bug #86: correctly decode cookie
+  
  -- Proxmox Support Team <support@proxmox.com>  Tue, 17 Jan 2012 06:36:23 +0100
 
 pve-manager (2.0-19) unstable; urgency=low
index 889b7a12da0244032b6a4a3c743013d68af003c7..7145025ef7fc454e022b11d4bbbf7101e374143a 100644 (file)
@@ -26,6 +26,8 @@ Ext.define('PVE.Workspace', {
        me.loginData = loginData;
        PVE.CSRFPreventionToken = loginData.CSRFPreventionToken;
        PVE.UserName = loginData.username;
+       var expire = Ext.Date.add(new Date(), Ext.Date.HOUR, 2);
+       Ext.util.Cookies.set('PVEAuthCookie', loginData.ticket, expire);
        me.onLogin(loginData);
     },
 
@@ -88,7 +90,6 @@ Ext.define('PVE.Workspace', {
                    url: '/api2/json/access/ticket',
                    method: 'POST',
                    success: function(response, opts) {
-                       // cookie is automatically updated
                        var obj = Ext.decode(response.responseText);
                        me.updateLoginData(obj.data);
                    }