added google authenticator support to the gui

This commit is contained in:
SJ
2013-10-16 14:55:17 +02:00
parent 62e5dc8afa
commit dae73a577a
50 changed files with 10676 additions and 39 deletions

View File

@ -1037,6 +1037,39 @@ var Piler =
{
var colour = $('#' + srcid).val();
$('#' + dstid).css('background', colour);
},
new_qr: function()
{
Piler.log("[new_qr]");
document.body.style.cursor = 'wait';
jQuery.ajax('qr.php?refresh=1', { cache: true })
.done( function(a) {
$('#QR').html(a);
document.body.style.cursor = 'default';
})
.fail(function(a, b) { alert("Problem retrieving XML data:" + b) });
},
toggle_ga: function()
{
var ga = 0;
if(document.getElementById('ga_enabled').checked == 1){ ga = 1; }
Piler.log("[toggle GA]", ga);
jQuery.ajax('qr.php?toggle=' + ga, { cache: true })
.done( function(a) {
})
.fail(function(a, b) { alert("Problem retrieving XML data:" + b) });
}

View File

@ -73,7 +73,7 @@
<?php } ?>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="icon-user"></i>&nbsp;<?php if(isset($_SESSION['realname'])) { print $_SESSION['realname']; ?>&nbsp;<?php } ?><b class="caret"></b></a>
<a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="icon-user"></i>&nbsp;<?php if($realname) { print $realname; ?>&nbsp;<?php } ?><b class="caret"></b></a>
<ul class="dropdown-menu">
<?php if($settings['support_link']) { ?>
<li><a href="<?php print $settings['support_link']; ?>" target="_blank" <?php if($settings['text_colour']) { ?> style="color: <?php print $settings['text_colour']; ?>;"<?php } ?>><i class="icon-question-sign"></i>&nbsp;<?php print $text_contact_support; ?></a></li>

View File

@ -0,0 +1,58 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title><?php if($title_prefix) { print $title_prefix; ?> | <?php } ?><?php print $title; ?></title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<?php if(SITE_KEYWORDS) { ?><meta name="keywords" content="<?php print SITE_KEYWORDS; ?>" /><?php } ?>
<?php if(SITE_DESCRIPTION) { ?><meta name="description" content="<?php print SITE_DESCRIPTION; ?>" /><?php } ?>
<?php if(PROVIDED_BY) { ?><meta name="author" content="<?php print PROVIDED_BY; ?>" /><?php } ?>
<link href="/view/theme/default/assets/css/metro-bootstrap.css" rel="stylesheet">
<!-- HTML5 shim, for IE6-8 support of HTML5 elements -->
<!-- original location: http://html5shim.googlecode.com/svn/trunk/html5.js -->
<!--[if lt IE 9]>
<script src="/view/theme/default/assets/js/html5.js"></script>
<![endif]-->
<!-- Fav and touch icons -->
<link rel="apple-touch-icon-precomposed" sizes="144x144" href="/view/theme/default/assets/ico/apple-touch-icon-144-precomposed.png">
<link rel="apple-touch-icon-precomposed" sizes="114x114" href="/view/theme/default/assets/ico/apple-touch-icon-114-precomposed.png">
<link rel="apple-touch-icon-precomposed" sizes="72x72" href="/view/theme/default/assets/ico/apple-touch-icon-72-precomposed.png">
<link rel="apple-touch-icon-precomposed" href="/view/theme/default/assets/ico/apple-touch-icon-57-precomposed.png">
<?php if(BRANDING_FAVICON) { ?><link rel="shortcut icon" href="<?php print BRANDING_FAVICON; ?>" /><?php } ?>
</head>
<body class="loginpage">
<div id="logincontainer" class="container">
<div id="logo-lg"><img src="<?php print SITE_URL; ?><?php print SITE_LOGO_LG; ?>" alt="Archive Logo Image" title="<?php print $text_login; ?>" /></div>
<form name="login" action="index.php?route=login/ga" method="post" class="form-signin">
<h2 class="form-signin-heading"><?php print $text_enter_google_authenticator_code; ?></h2>
<?php if(isset($x)){ ?><p class="alert alert-error lead"><?php print $x; ?></p><?php } ?>
<input type="hidden" name="relocation" value="<?php if(isset($_GET['route']) && !preg_match("/^login/", $_GET['route']) ) { if(isset($_SERVER['REDIRECT_URL'])) { print $_SERVER['REDIRECT_URL']; } else { print $_SERVER['QUERY_STRING']; } } ?>" />
<input type="password" class="input-block-level bold" id="ga_code" name="ga_code" placeholder="<?php print $text_google_authenticator_code; ?>">
<button class="btn btn-large btn-primary" type="submit" value="<?php print $text_submit; ?>"><?php print $text_submit; ?></button>
</form>
<div id="compatibility" class="well well-large">
<p><?php print COMPATIBILITY; ?></p>
</div>
</div>
<?php if(TRACKING_CODE) { print TRACKING_CODE; } ?>
</body>
</html>

View File

@ -93,6 +93,29 @@
</form>
<form method="post" name="setqr" class="form-horizontal">
<h4><?php print $text_google_authenticator_settings; ?></h4>
<div class="control-group">
<label class="control-label" for="ga_enabled"><?php print $text_enable; ?></label>
<div class="controls">
<input type="checkbox" name="ga_enabled" id="ga_enabled" onclick="Piler.toggle_ga();" <?php if($ga['ga_enabled'] == 1) { ?>checked="checked"<?php } ?> />
</div>
</div>
<div class="control-group">
<label class="control-label" for="ga_secret"><?php print $text_qr_code; ?></label>
<div id="QR" class="controls">
<?php print $ga['ga_secret']; ?> <a href="#" onclick="Piler.new_qr(); return false;"> <?php print $text_refresh_qr_code; ?></a><br /><img src="qr.php?ts=<?php print time(); ?>" />
</div>
</div>
</form>
<p>&nbsp;</p>
<?php if(PASSWORD_CHANGE_ENABLED == 1) { ?>

View File

@ -69,7 +69,7 @@
<?php if($settings['branding_url']) { ?><li><a href="<?php print $settings['branding_url']; ?>" target="_blank" <?php if($settings['text_colour']) { ?> style="color: <?php print $settings['text_colour']; ?>;"<?php } ?>><i class="icon-share-alt icon-white"></i> <?php print $settings['branding_text']; ?></a></li><?php } ?>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" <?php if($settings['text_colour']) { ?> style="color: <?php print $settings['text_colour']; ?>;"<?php } ?>><?php print $_SESSION['realname']; ?> <i class="icon-user icon-white"></i> <b class="caret"></b></a>
<a href="#" class="dropdown-toggle" data-toggle="dropdown" <?php if($settings['text_colour']) { ?> style="color: <?php print $settings['text_colour']; ?>;"<?php } ?>><?php print $realname; ?> <i class="icon-user icon-white"></i> <b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="settings.php"><i class="icon-cog"></i>&nbsp;<?php print $text_settings; ?></a></li>
<li class="divider"></li>

View File

@ -0,0 +1,61 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="hu" lang="hu">
<head>
<title><?php if($title_prefix) { print $title_prefix; ?> | <?php } ?><?php print $title; ?></title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Language" content="en" />
<?php if(SITE_KEYWORDS) { ?><meta name="keywords" content="<?php print SITE_KEYWORDS; ?>" /><?php } ?>
<?php if(SITE_DESCRIPTION) { ?><meta name="description" content="<?php print SITE_DESCRIPTION; ?>" /><?php } ?>
<?php if(PROVIDED_BY) { ?><meta name="author" content="<?php print PROVIDED_BY; ?>" /><?php } ?>
<meta name="rating" content="general" />
<meta name="robots" content="all" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="/bootstrap/css/bootstrap<?php print BOOTSTRAP_THEME; ?>.min.css" rel="stylesheet" media="screen">
<link href="/bootstrap/css/bootstrap-responsive.min.css" rel="stylesheet" media="screen">
<link rel="stylesheet" type="text/css" href="/view/theme/<?php print THEME; ?>/stylesheet/jquery-ui-custom.min.css" />
<link rel="stylesheet" type="text/css" href="/view/theme/<?php print THEME; ?>/stylesheet/style-<?php print THEME; ?>.css" />
<script type="text/javascript" src="/view/javascript/jquery.min.js"></script>
<script type="text/javascript" src="/view/javascript/jquery-ui-custom.min.js"></script>
<script type="text/javascript" src="/view/javascript/bootstrap.min.js"></script>
<script type="text/javascript" src="/view/javascript/rc-splitter.js"></script>
<script type="text/javascript" src="/view/javascript/piler.js"></script>
<?php if(BRANDING_FAVICON) { ?><link rel="shortcut icon" href="<?php print BRANDING_FAVICON; ?>" /><?php } ?>
</head>
<body class="loginpage">
<div id="logincontainer" class="container">
<div id="logo-lg"><img src="<?php print SITE_URL; ?><?php print SITE_LOGO_LG; ?>" alt="Archive Logo Image" title="<?php print $text_login; ?>" /></div>
<form name="login" action="index.php?route=login/ga" method="post" class="form-signin">
<h2 class="form-signin-heading"><?php print $text_enter_google_authenticator_code; ?></h2>
<?php if(isset($x)){ ?><p class="alert alert-error lead"><?php print $x; ?></p><?php } ?>
<input type="hidden" name="relocation" value="<?php if(isset($_GET['route']) && !preg_match("/^login/", $_GET['route']) ) { if(isset($_SERVER['REDIRECT_URL'])) { print $_SERVER['REDIRECT_URL']; } else { print $_SERVER['QUERY_STRING']; } } ?>" />
<input type="password" class="input-block-level bold" name="ga_code" placeholder="<?php print $text_google_authenticator_code; ?>">
<button class="btn btn-large btn-primary" type="submit" value="<?php print $text_submit; ?>"><?php print $text_submit; ?></button>
</form>
<div id="compatibility" class="well well-large">
<p><?php print COMPATIBILITY; ?></p>
</div>
</div>
<?php if(TRACKING_CODE) { print TRACKING_CODE; } ?>
</body>
</html>

View File

@ -102,12 +102,38 @@
</div>
</div>
</form>
<p>&nbsp;</p>
<div id="search">
<h4><?php print $text_google_authenticator_settings; ?></h4>
<div id="search1">
<div class="row">
<div class="logincell"><?php print $text_enable; ?>:</div>
<div class="logincell"><input type="checkbox" name="ga_enabled" id="ga_enabled" onclick="Piler.toggle_ga();" <?php if($ga['ga_enabled'] == 1) { ?>checked="checked"<?php } ?> /></div>
</div>
<div class="row">
<div class="logincell"><?php print $text_qr_code; ?>:</div>
<div id="QR" class="logincell">
<?php print $ga['ga_secret']; ?> <a href="#" onclick="Piler.new_qr(); return false;"><?php print $text_refresh_qr_code; ?></a><br /><img src="qr.php?ts=<?php print time(); ?>" />
</div>
</div>
</div>
<p>&nbsp;</p>
<?php if(PASSWORD_CHANGE_ENABLED == 1) { ?>
<div id="search">
<form method="post" name="pwdchange" action="settings.php" class="formbottom">