Commit d56f4f8b authored by Leigh Stoller's avatar Leigh Stoller

Tweaks to Geni login code. Hide the button from login page and

login modal, must use the original direct geni-login.php page
until we go live.
parent 980f6cbd
......@@ -41,7 +41,9 @@ window.APT_OPTIONS.initialize = function (sup)
if ($('#quickvm_geni_login_button').length) {
$('#quickvm_geni_login_button').click(function (event) {
event.preventDefault();
sup.HideModal("#quickvm_login_modal");
if ($('#quickvm_login_modal').length) {
sup.HideModal("#quickvm_login_modal");
}
sup.StartGeniLogin();
return false;
});
......@@ -54,12 +56,14 @@ window.APT_OPTIONS.initialize = function (sup)
$('#loginbutton').click(function (event) {
event.preventDefault();
sup.ShowModal('#quickvm_login_modal');
console.info("Loading geni auth code");
sup.InitGeniLogin();
require([geniauth], function() {
console.info("Geni auth code has been loaded");
$('#quickvm_geni_login_button').removeAttr("disabled");
});
if (window.ISCLOUD) {
console.info("Loading geni auth code");
sup.InitGeniLogin();
require([geniauth], function() {
console.info("Geni auth code has been loaded");
$('#quickvm_geni_login_button').removeAttr("disabled");
});
}
return false;
});
}
......
require(window.APT_OPTIONS.configObject,
['underscore', 'js/quickvm_sup'],
function (_, sup)
{
'use strict';
function initialize()
{
// We share code with the modal version of login, and the
// handler for the button is installed in initialize().
// See comment there.
if (window.ISCLOUD) {
sup.InitGeniLogin();
}
window.APT_OPTIONS.initialize(sup);
}
$(document).ready(initialize);
});
......@@ -78,7 +78,7 @@ if (NOLOGINS()) {
function SPITFORM($uid, $referrer, $error)
{
global $TBDB_UIDLEN, $TBBASE, $refer;
global $ISAPT;
global $ISAPT, $ISCLOUD;
$pwlab = ($ISAPT ? "Aptlab.net" : "CloudLab.net") .
" or Emulab.net Username";
......@@ -148,9 +148,17 @@ function SPITFORM($uid, $referrer, $error)
</div>
<div class='form-group'>
<div class='col-sm-offset-2 col-sm-10'>
<?php
if ($ISCLOUD) {
?>
<button class='btn btn-info btn-sm pull-left'
type='button'
id='quickvm_geni_login_button'>Geni User?</button>
type='button'
data-toggle="tooltip" data-placement="left"
title="You can use your geni credentials to login"
id='quickvm_geni_login_button'>Geni User?</button>
<?php
}
?>
<button class='btn btn-primary btn-sm pull-right'
id='quickvm_login_modal_button'
type='submit' name='login'>Login</button>
......@@ -164,10 +172,15 @@ function SPITFORM($uid, $referrer, $error)
</form>
</div>
</div>\n";
if ($ISCLOUD) {
echo "<script
src='https://www.emulab.net/protogeni/speaks-for/geni-auth.js'>
</script>\n";
}
echo "<script src='js/lib/jquery-2.0.3.min.js'></script>\n";
echo "<script src='js/lib/bootstrap.js'></script>\n";
echo "<script src='js/lib/require.js' data-main='js/main'></script>";
echo "<script src='js/lib/require.js' data-main='js/login'></script>";
SPITFOOTER();
return;
}
......
......@@ -32,6 +32,7 @@ $FAVICON = "aptlab.ico";
$APTLOGO = "aptlogo.png";
$APTSTYLE = "apt.css";
$ISAPT = 1;
$ISCLOUD = 0;
$ISVSERVER = 0;
$GOOGLEUA = 'UA-45161989-1';
......@@ -59,7 +60,7 @@ if ($TBMAINSITE && $_SERVER["SERVER_NAME"] == "www.aptlab.net") {
$GOOGLEUA = 'UA-42844769-3';
$TBMAILTAG = "aptlab.net";
}
elseif (($TBMAINSITE && $_SERVER["SERVER_NAME"] == "www.cloudlab.us")) {
elseif (0 || ($TBMAINSITE && $_SERVER["SERVER_NAME"] == "www.cloudlab.us")) {
$ISVSERVER = 1;
$TBAUTHDOMAIN = ".cloudlab.us";
$COOKDIEDOMAIN= $TBAUTHDOMAIN;
......@@ -72,6 +73,7 @@ elseif (($TBMAINSITE && $_SERVER["SERVER_NAME"] == "www.cloudlab.us")) {
$APTLOGO = "cloudlogo.png";
$APTSTYLE = "cloudlab.css";
$ISAPT = 0;
$ISCLOUD = 1;
$GOOGLEUA = 'UA-42844769-2';
$TBMAILTAG = "cloudlab.us";
}
......@@ -358,7 +360,7 @@ function SpitVerifyModal($id, $label)
#
function SpitLoginModal($id)
{
global $APTTITLE, $ISAPT;
global $APTTITLE, $ISAPT, $ISCLOUD;
$pwlab = ($ISAPT ? "Aptlab.net" : "CloudLab.net") .
" or Emulab.net Username";
$pwlab = "$pwlab";
......@@ -399,11 +401,17 @@ function SpitLoginModal($id)
</div>
<div class='form-group'>
<div class='col-sm-offset-2 col-sm-10'>
<?php
if ($ISCLOUD) {
?>
<button class='btn btn-info btn-sm pull-left' disabled
type='button'
data-toggle="tooltip" data-placement="left"
title="You can use your geni credentials to login"
id='quickvm_geni_login_button'>Geni User?</button>
<?php
}
?>
<button class='btn btn-primary btn-sm pull-right'
id='quickvm_login_modal_button'
type='submit' name='login'>Login</button>
......
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