Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
emulab
emulab-devel
Commits
4784e571
Commit
4784e571
authored
Sep 15, 2014
by
Leigh B Stoller
Browse files
Add new landing page, to redirect user to log in page or myexperiments.
parent
9dfeca47
Changes
3
Hide whitespace changes
Inline
Side-by-side
www/aptui/landing.php
0 → 100644
View file @
4784e571
<?php
#
# Copyright (c) 2000-2014 University of Utah and the Flux Group.
#
# {{{EMULAB-LICENSE
#
# This file is part of the Emulab network testbed software.
#
# This file is free software: you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or (at
# your option) any later version.
#
# This file is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
# License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this file. If not, see <http://www.gnu.org/licenses/>.
#
# }}}
#
chdir
(
".."
);
include
(
"defs.php3"
);
include_once
(
"geni_defs.php"
);
chdir
(
"apt"
);
include
(
"quickvm_sup.php"
);
include
(
"instance_defs.php"
);
#
# Get current user but make sure coming in on SSL.
#
RedirectSecure
();
$this_user
=
CheckLogin
(
$check_status
);
if
(
$ISCLOUD
)
{
if
(
!
(
$CHECKLOGIN_STATUS
&
CHECKLOGIN_LOGGEDIN
))
{
header
(
"Location: login.php"
);
return
;
}
}
#
# Verify page arguments.
#
$optargs
=
OptionalPageArguments
(
"asguest"
,
PAGEARG_BOOLEAN
,
"from"
,
PAGEARG_STRING
);
#
# Redirect logged in user.
#
if
(
$this_user
)
{
if
(
Instance
::
UserHasInstances
(
$this_user
))
{
header
(
"Location:
$APTBASE
/myexperiments.php"
);
}
else
{
header
(
"Location:
$APTBASE
/instantiate.php"
);
}
return
;
}
#
# APT users might be guests.
#
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?from=landing"
);
return
;
}
}
}
#
# A guest user. Go directly to status page.
#
if
(
isset
(
$_COOKIE
[
'quickvm_user'
]))
{
$geniuser
=
GeniUser
::
Lookup
(
"sa"
,
$_COOKIE
[
'quickvm_user'
]);
if
(
$geniuser
)
{
#
# Look for existing quickvm. Show that.
#
$instance
=
Instance
::
LookupByCreator
(
$geniuser
->
uuid
());
if
(
$instance
&&
$instance
->
status
()
!=
"terminating"
)
{
header
(
"Location: status.php?uuid="
.
$instance
->
uuid
());
return
;
}
}
}
header
(
"Location:
$APTBASE
/instantiate.php"
);
?>
www/aptui/login.php
View file @
4784e571
...
...
@@ -25,7 +25,6 @@ chdir("..");
include
(
"defs.php3"
);
chdir
(
"apt"
);
include
(
"quickvm_sup.php"
);
include
(
"instance_defs.php"
);
$page_title
=
"Login"
;
#
...
...
@@ -41,6 +40,7 @@ $optargs = OptionalPageArguments("login", PAGEARG_STRING,
"password"
,
PAGEARG_PASSWORD
,
"refer"
,
PAGEARG_BOOLEAN
,
"referrer"
,
PAGEARG_STRING
,
"from"
,
PAGEARG_STRING
,
"ajax_request"
,
PAGEARG_BOOLEAN
);
# See if referrer page requested that it be passed along so that it can be
...
...
@@ -57,6 +57,16 @@ if (isset($refer) &&
$referrer
=
null
;
}
#
# We want to show guest login, when redirected from the landing page
# or from the instantiate page. APT only.
#
$showguestlogin
=
0
;
if
(
$ISAPT
&&
isset
(
$from
)
&&
(
$from
==
"landing"
||
$from
==
"instantiate"
))
{
$showguestlogin
=
1
;
}
if
(
NOLOGINS
())
{
if
(
$ajax_request
)
{
SPITAJAX_ERROR
(
1
,
"logins are temporarily disabled"
);
...
...
@@ -78,7 +88,7 @@ if (NOLOGINS()) {
function
SPITFORM
(
$uid
,
$referrer
,
$error
)
{
global
$TBDB_UIDLEN
,
$TBBASE
,
$refer
;
global
$ISAPT
,
$ISCLOUD
;
global
$ISAPT
,
$ISCLOUD
,
$showguestlogin
;
$pwlab
=
(
$ISAPT
?
"Aptlab.net"
:
"CloudLab.net"
)
.
" or Emulab.net Username"
;
...
...
@@ -158,7 +168,7 @@ function SPITFORM($uid, $referrer, $error)
id=
'quickvm_geni_login_button'
>
Geni User?
</button>
<?php
}
if
(
$ISAPT
)
{
if
(
$ISAPT
&&
REMEMBERED_ID
()
&&
$showguestlogin
)
{
?>
<a
class=
'btn btn-info btn-sm pull-left'
href=
'instantiate.php?asguest=1'
...
...
@@ -196,12 +206,7 @@ function SPITFORM($uid, $referrer, $error)
#
if
(
!
$ajax_request
&&
!
isset
(
$login
))
{
if
(
$this_user
)
{
if
(
Instance
::
UserHasInstances
(
$this_user
))
{
header
(
"Location:
$APTBASE
/myexperiments.php"
);
}
else
{
header
(
"Location:
$APTBASE
/instantiate.php"
);
}
header
(
"Location:
$APTBASE
/landing.php"
);
return
;
}
SPITFORM
(
REMEMBERED_ID
(),
$referrer
,
null
);
...
...
@@ -275,11 +280,6 @@ elseif (isset($referrer)) {
header
(
"Location:
$referrer
"
);
}
else
{
if
(
Instance
::
UserHasInstances
(
$CHECKLOGIN_USER
))
{
header
(
"Location:
$APTBASE
/myexperiments.php"
);
}
else
{
header
(
"Location:
$APTBASE
/instantiate.php"
);
}
header
(
"Location:
$APTBASE
/landing.php"
);
}
?>
www/aptui/quickvm_sup.php
View file @
4784e571
...
...
@@ -207,7 +207,7 @@ function SPITHEADER($thinheader = 0)
echo
" </ul>
<ul class='nav navbar-nav navbar-left apt-left'>
<li class='apt-left'><form><a class='btn btn-quickvm-home navbar-btn'
href='
instantiate
.php'>Home</a></form></li>
\n
"
;
href='
landing
.php'>Home</a></form></li>
\n
"
;
if
(
$ISAPT
)
{
echo
" <li class='apt-left'><form><a class='btn btn-quickvm-home navbar-btn'
href='http://docs.aptlab.net' target='_blank'>Manual</a></form></li>
\n
"
;
...
...
@@ -224,6 +224,7 @@ function SPITHEADER($thinheader = 0)
<li><a href='myprofiles.php'>My Profiles</a></li>
<li><a href='myexperiments.php'>My Experiments</a></li>
<li><a href='manage_profile.php'>Create Profile</a></li>
<li><a href='instantiate.php'>Start Experiment</a></li>
<li class='divider'></li>
<li><a href='logout.php'>Logout</a></li>"
;
if
(
ISADMIN
())
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment