From 37843be6f20218f22601aecc556496dd33927efe Mon Sep 17 00:00:00 2001 From: Leigh B Stoller Date: Wed, 10 Sep 2014 14:27:57 -0600 Subject: [PATCH] On APT home page (instantiate.php) if there is an emulab user cookie, we know (suspect) the user has an account, so redirect to the login page. There is a new Continue as Guest button on the login page in case that is what the user really wants to do. --- www/aptui/instantiate.php | 23 ++++++++++++++++++++++- www/aptui/login.php | 7 +++++++ www/tbauth.php3 | 8 +++++++- 3 files changed, 36 insertions(+), 2 deletions(-) diff --git a/www/aptui/instantiate.php b/www/aptui/instantiate.php index 396ea4120..a3b87301e 100755 --- a/www/aptui/instantiate.php +++ b/www/aptui/instantiate.php @@ -37,7 +37,7 @@ $dblink = GetDBLink("sa"); # RedirectSecure(); $this_user = CheckLogin($check_status); -if (!$ISAPT) { +if ($ISCLOUD) { if (! ($CHECKLOGIN_STATUS & CHECKLOGIN_LOGGEDIN)) { header("Location: login.php"); } @@ -52,7 +52,28 @@ $optargs = OptionalPageArguments("create", PAGEARG_STRING, "stuffing", PAGEARG_STRING, "verify", PAGEARG_STRING, "project", PAGEARG_PROJECT, + "asguest", PAGEARG_BOOLEAN, "formfields", PAGEARG_ARRAY); + +if ($ISAPT) { + # + # If user appears to have an account, go to login page. + # Continue as guest on that page. + # + if (REMEMBERED_ID()) { + if (isset($asguest) && $asguest) { + # User clicked on continue as guest. If we do not delete the + # cookie, then user will go through the same loop next time + # they click the Home button, since that points here. So delete + # the UID cookie. Not sure I like this. + ClearRememberedID(); + } + else { + header("Location: login.php"); + } + } +} + if ($ISCLOUD) { $profile_default = "OpenStack"; $profile_default_pid = "tbres"; diff --git a/www/aptui/login.php b/www/aptui/login.php index faccbd682..c826398ef 100644 --- a/www/aptui/login.php +++ b/www/aptui/login.php @@ -158,6 +158,13 @@ function SPITFORM($uid, $referrer, $error) id='quickvm_geni_login_button'>Geni User? + Continue as Guest +