From 409f4c46fb4247da16e6f3462eebb72b15d27a50 Mon Sep 17 00:00:00 2001 From: Leigh B Stoller Date: Thu, 10 Oct 2013 15:06:52 -0600 Subject: [PATCH] Fix up cookie handling for virtual host, and use insecure flag until we have our new certificate. --- www/aptui/quickvm.php | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/www/aptui/quickvm.php b/www/aptui/quickvm.php index 580dd5fec..dd3d55b50 100644 --- a/www/aptui/quickvm.php +++ b/www/aptui/quickvm.php @@ -417,11 +417,27 @@ if (! $creator) { SPITFOOTER(); return; } +# # Remember the user and auth key so that we can verify. +# +# The cookie handling is a pain since we run this under the aptlab +# virtual host, but the config uses a different domain, and so the +# cookies do not work. So, we have to look at our SERVER_NAME and +# set the cookie appropriately. +# +if (stristr($_SERVER["SERVER_NAME"], $TBAUTHDOMAIN)) { + $cookiedomain = $TBAUTHDOMAIN; +} +else { + $cookiedomain = $_SERVER["SERVER_NAME"]; +} + setcookie("quickvm_user", - $creator->uuid(), 0, "/", $TBAUTHDOMAIN, $TBSECURECOOKIES); + $creator->uuid(), time() + (24 * 3600 * 30), + "/", $cookiedomain, 0); setcookie("quickvm_authkey", - $creator->auth_token(), 0, "/", $TBAUTHDOMAIN, $TBSECURECOOKIES); + $creator->auth_token(), time() + (24 * 3600 * 30), + "/", $cookiedomain, 0); header("Location: quickvm_status.php?uuid=" . $quickvm->uuid()); ?> -- GitLab