Commit 37843be6 authored by Leigh B Stoller's avatar Leigh B Stoller

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.
parent 0e3a7be5
...@@ -37,7 +37,7 @@ $dblink = GetDBLink("sa"); ...@@ -37,7 +37,7 @@ $dblink = GetDBLink("sa");
# #
RedirectSecure(); RedirectSecure();
$this_user = CheckLogin($check_status); $this_user = CheckLogin($check_status);
if (!$ISAPT) { if ($ISCLOUD) {
if (! ($CHECKLOGIN_STATUS & CHECKLOGIN_LOGGEDIN)) { if (! ($CHECKLOGIN_STATUS & CHECKLOGIN_LOGGEDIN)) {
header("Location: login.php"); header("Location: login.php");
} }
...@@ -52,7 +52,28 @@ $optargs = OptionalPageArguments("create", PAGEARG_STRING, ...@@ -52,7 +52,28 @@ $optargs = OptionalPageArguments("create", PAGEARG_STRING,
"stuffing", PAGEARG_STRING, "stuffing", PAGEARG_STRING,
"verify", PAGEARG_STRING, "verify", PAGEARG_STRING,
"project", PAGEARG_PROJECT, "project", PAGEARG_PROJECT,
"asguest", PAGEARG_BOOLEAN,
"formfields", PAGEARG_ARRAY); "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) { if ($ISCLOUD) {
$profile_default = "OpenStack"; $profile_default = "OpenStack";
$profile_default_pid = "tbres"; $profile_default_pid = "tbres";
......
...@@ -158,6 +158,13 @@ function SPITFORM($uid, $referrer, $error) ...@@ -158,6 +158,13 @@ function SPITFORM($uid, $referrer, $error)
id='quickvm_geni_login_button'>Geni User?</button> id='quickvm_geni_login_button'>Geni User?</button>
<?php <?php
} }
if ($ISAPT) {
?>
<a class='btn btn-info btn-sm pull-left'
href='instantiate.php?asguest=1'
type='button'>Continue as Guest</a>
<?php
}
?> ?>
<button class='btn btn-primary btn-sm pull-right' <button class='btn btn-primary btn-sm pull-right'
id='quickvm_login_modal_button' id='quickvm_login_modal_button'
......
...@@ -111,6 +111,12 @@ function REMEMBERED_ID() { ...@@ -111,6 +111,12 @@ function REMEMBERED_ID() {
} }
return null; return null;
} }
function ClearRememberedID()
{
global $TBEMAILCOOKIE, $WWWHOST;
setcookie($TBEMAILCOOKIE, '', 1, "/", $WWWHOST, 0);
}
# #
# Return the value of the currently logged in uid, or null if not # Return the value of the currently logged in uid, or null if not
...@@ -396,8 +402,8 @@ function LoginStatus() { ...@@ -396,8 +402,8 @@ function LoginStatus() {
# No hash of the hash, so assume no real cookie either. # No hash of the hash, so assume no real cookie either.
# #
$CHECKLOGIN_STATUS = CHECKLOGIN_NOTLOGGEDIN; $CHECKLOGIN_STATUS = CHECKLOGIN_NOTLOGGEDIN;
return $CHECKLOGIN_STATUS;
} }
return $CHECKLOGIN_STATUS;
} }
# Cache this now; someone will eventually want it. # Cache this now; someone will eventually want it.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment