2014-08-17 22:43:57 +00:00
|
|
|
<!DOCTYPE html>
|
2015-04-11 19:39:35 +00:00
|
|
|
<html lang="en">
|
2014-08-17 22:43:57 +00:00
|
|
|
<head>
|
|
|
|
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
2015-04-11 19:39:35 +00:00
|
|
|
<meta charset="utf-8">
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
2014-08-17 22:43:57 +00:00
|
|
|
|
|
|
|
<title>{{hostname}} - Mail-in-a-Box Control Panel</title>
|
|
|
|
|
|
|
|
<meta name="robots" content="noindex, nofollow">
|
|
|
|
|
2017-05-31 11:36:17 +00:00
|
|
|
<link rel="stylesheet" href="/admin/assets/bootstrap/css/bootstrap.min.css">
|
2014-08-17 22:43:57 +00:00
|
|
|
<style>
|
2015-09-04 22:21:10 +00:00
|
|
|
body {
|
2014-08-17 22:43:57 +00:00
|
|
|
overflow-y: scroll;
|
|
|
|
padding-bottom: 20px;
|
|
|
|
}
|
|
|
|
|
|
|
|
p {
|
|
|
|
margin-bottom: 1.25em;
|
|
|
|
}
|
|
|
|
|
2014-08-27 12:11:38 +00:00
|
|
|
h1, h2, h3, h4 {
|
2015-09-18 19:04:28 +00:00
|
|
|
font-family: sans-serif;
|
2014-08-17 22:43:57 +00:00
|
|
|
font-weight: bold;
|
|
|
|
}
|
|
|
|
|
|
|
|
h2 {
|
|
|
|
margin: 1em 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
h3 {
|
|
|
|
font-size: 130%;
|
|
|
|
border-bottom: 1px solid black;
|
|
|
|
padding-bottom: 3px;
|
|
|
|
margin-bottom: 13px;
|
2014-08-27 12:11:38 +00:00
|
|
|
margin-top: 30px;
|
|
|
|
}
|
2014-10-21 11:08:44 +00:00
|
|
|
.panel-heading h3 {
|
|
|
|
border: none;
|
|
|
|
padding: 0;
|
|
|
|
margin: 0;
|
|
|
|
}
|
2014-08-27 12:11:38 +00:00
|
|
|
|
|
|
|
h4 {
|
|
|
|
font-size: 110%;
|
|
|
|
margin-bottom: 13px;
|
|
|
|
margin-top: 18px;
|
2014-08-17 22:43:57 +00:00
|
|
|
}
|
2014-10-21 11:08:44 +00:00
|
|
|
h4:first-child {
|
|
|
|
margin-top: 6px;
|
|
|
|
}
|
2014-08-17 22:43:57 +00:00
|
|
|
|
2014-10-21 11:01:23 +00:00
|
|
|
.admin_panel {
|
2014-08-17 22:43:57 +00:00
|
|
|
display: none;
|
|
|
|
}
|
|
|
|
|
|
|
|
table.table {
|
|
|
|
margin: 1.5em 0;
|
|
|
|
}
|
2014-10-07 16:05:38 +00:00
|
|
|
|
|
|
|
ol li {
|
|
|
|
margin-bottom: 1em;
|
|
|
|
}
|
2014-08-17 22:43:57 +00:00
|
|
|
</style>
|
2017-05-31 11:36:17 +00:00
|
|
|
<link rel="stylesheet" href="/admin/assets/bootstrap/css/bootstrap-theme.min.css">
|
2014-08-17 22:43:57 +00:00
|
|
|
</head>
|
|
|
|
<body>
|
2015-04-11 19:39:35 +00:00
|
|
|
|
|
|
|
<!--[if lt IE 8]><p>Internet Explorer version 8 or any modern web browser is required to use this website, sorry.<![endif]-->
|
|
|
|
<!--[if gt IE 7]><!-->
|
|
|
|
|
2016-01-14 14:48:39 +00:00
|
|
|
<div class="navbar navbar-inverse navbar-static-top" role="navigation">
|
2014-08-17 22:43:57 +00:00
|
|
|
<div class="container">
|
|
|
|
<div class="navbar-header">
|
2015-04-11 19:39:35 +00:00
|
|
|
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target=".navbar-collapse">
|
|
|
|
<span class="sr-only">Toggle navigation</span>
|
2014-08-17 22:43:57 +00:00
|
|
|
<span class="icon-bar"></span>
|
|
|
|
<span class="icon-bar"></span>
|
|
|
|
<span class="icon-bar"></span>
|
|
|
|
</button>
|
|
|
|
<a class="navbar-brand" href="#">{{hostname}}</a>
|
|
|
|
</div>
|
|
|
|
<div class="navbar-collapse collapse">
|
|
|
|
<ul class="nav navbar-nav">
|
2014-10-07 15:12:35 +00:00
|
|
|
<li class="dropdown">
|
2014-08-17 22:43:57 +00:00
|
|
|
<a href="#" class="dropdown-toggle" data-toggle="dropdown">System <b class="caret"></b></a>
|
|
|
|
<ul class="dropdown-menu">
|
|
|
|
<li><a href="#system_status" onclick="return show_panel(this);">Status Checks</a></li>
|
2016-01-02 23:01:20 +00:00
|
|
|
<li><a href="#tls" onclick="return show_panel(this);">TLS (SSL) Certificates</a></li>
|
2014-09-01 13:06:38 +00:00
|
|
|
<li><a href="#system_backup" onclick="return show_panel(this);">Backup Status</a></li>
|
|
|
|
<li class="divider"></li>
|
2015-06-06 13:22:50 +00:00
|
|
|
<li class="dropdown-header">Advanced Pages</li>
|
2014-10-05 13:38:23 +00:00
|
|
|
<li><a href="#custom_dns" onclick="return show_panel(this);">Custom DNS</a></li>
|
|
|
|
<li><a href="#external_dns" onclick="return show_panel(this);">External DNS</a></li>
|
2016-05-17 23:46:45 +00:00
|
|
|
<li><a href="/admin/munin" target="_blank">Munin Monitoring</a></li>
|
2014-08-17 22:43:57 +00:00
|
|
|
</ul>
|
|
|
|
</li>
|
2014-10-07 15:12:35 +00:00
|
|
|
<li class="dropdown">
|
2020-09-27 12:31:23 +00:00
|
|
|
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Mail & Users <b class="caret"></b></a>
|
2014-08-17 22:43:57 +00:00
|
|
|
<ul class="dropdown-menu">
|
2014-10-07 15:12:35 +00:00
|
|
|
<li><a href="#mail-guide" onclick="return show_panel(this);">Instructions</a></li>
|
2014-08-17 22:43:57 +00:00
|
|
|
<li><a href="#users" onclick="return show_panel(this);">Users</a></li>
|
|
|
|
<li><a href="#aliases" onclick="return show_panel(this);">Aliases</a></li>
|
2020-09-27 12:31:23 +00:00
|
|
|
<li class="divider"></li>
|
|
|
|
<li class="dropdown-header">Your Account</li>
|
|
|
|
<li><a href="#mfa" onclick="return show_panel(this);">Two-Factor Authentication</a></li>
|
2014-08-17 22:43:57 +00:00
|
|
|
</ul>
|
|
|
|
</li>
|
2014-10-07 15:12:35 +00:00
|
|
|
<li><a href="#sync_guide" onclick="return show_panel(this);">Contacts/Calendar</a></li>
|
2014-10-07 16:05:38 +00:00
|
|
|
<li><a href="#web" onclick="return show_panel(this);">Web</a></li>
|
2014-08-17 22:43:57 +00:00
|
|
|
</ul>
|
|
|
|
<ul class="nav navbar-nav navbar-right">
|
2017-08-23 23:46:45 +00:00
|
|
|
<li><a href="#" onclick="do_logout(); return false;" style="color: white">Log out</a></li>
|
2014-08-17 22:43:57 +00:00
|
|
|
</ul>
|
|
|
|
</div><!--/.navbar-collapse -->
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
2014-10-21 10:56:52 +00:00
|
|
|
<div class="container">
|
2014-10-21 11:01:23 +00:00
|
|
|
<div id="panel_system_status" class="admin_panel">
|
2014-08-17 22:43:57 +00:00
|
|
|
{% include "system-status.html" %}
|
|
|
|
</div>
|
|
|
|
|
2014-10-21 11:01:23 +00:00
|
|
|
<div id="panel_system_backup" class="admin_panel">
|
2014-09-01 13:06:38 +00:00
|
|
|
{% include "system-backup.html" %}
|
|
|
|
</div>
|
|
|
|
|
2014-10-21 11:01:23 +00:00
|
|
|
<div id="panel_external_dns" class="admin_panel">
|
2014-10-05 13:38:23 +00:00
|
|
|
{% include "external-dns.html" %}
|
|
|
|
</div>
|
|
|
|
|
2014-10-21 11:01:23 +00:00
|
|
|
<div id="panel_custom_dns" class="admin_panel">
|
2014-10-05 13:38:23 +00:00
|
|
|
{% include "custom-dns.html" %}
|
2014-08-17 22:43:57 +00:00
|
|
|
</div>
|
|
|
|
|
2020-09-27 12:31:23 +00:00
|
|
|
<div id="panel_mfa" class="admin_panel">
|
|
|
|
{% include "mfa.html" %}
|
2020-09-02 14:48:23 +00:00
|
|
|
</div>
|
|
|
|
|
2020-09-02 17:41:06 +00:00
|
|
|
<div id="panel_login" class="admin_panel">
|
2014-08-17 22:43:57 +00:00
|
|
|
{% include "login.html" %}
|
|
|
|
</div>
|
|
|
|
|
2014-10-21 11:01:23 +00:00
|
|
|
<div id="panel_mail-guide" class="admin_panel">
|
2014-08-17 22:43:57 +00:00
|
|
|
{% include "mail-guide.html" %}
|
|
|
|
</div>
|
|
|
|
|
2014-10-21 11:01:23 +00:00
|
|
|
<div id="panel_users" class="admin_panel">
|
2014-08-17 22:43:57 +00:00
|
|
|
{% include "users.html" %}
|
|
|
|
</div>
|
|
|
|
|
2014-10-21 11:01:23 +00:00
|
|
|
<div id="panel_aliases" class="admin_panel">
|
2014-08-17 22:43:57 +00:00
|
|
|
{% include "aliases.html" %}
|
|
|
|
</div>
|
|
|
|
|
2014-10-21 11:01:23 +00:00
|
|
|
<div id="panel_sync_guide" class="admin_panel">
|
2014-09-03 10:51:19 +00:00
|
|
|
{% include "sync-guide.html" %}
|
|
|
|
</div>
|
|
|
|
|
2014-10-21 11:01:23 +00:00
|
|
|
<div id="panel_web" class="admin_panel">
|
2014-10-07 16:05:38 +00:00
|
|
|
{% include "web.html" %}
|
|
|
|
</div>
|
|
|
|
|
2016-01-02 23:01:20 +00:00
|
|
|
<div id="panel_tls" class="admin_panel">
|
2014-10-10 15:49:14 +00:00
|
|
|
{% include "ssl.html" %}
|
|
|
|
</div>
|
|
|
|
|
2014-08-17 22:43:57 +00:00
|
|
|
<hr>
|
|
|
|
|
|
|
|
<footer>
|
|
|
|
<p>This is a <a href="https://mailinabox.email">Mail-in-a-Box</a>.</p>
|
|
|
|
</footer>
|
|
|
|
</div> <!-- /container -->
|
|
|
|
|
2015-04-11 19:39:35 +00:00
|
|
|
<div id="ajax_loading_indicator" style="display: none; position: fixed; left: 0; top: 0; width: 100%; height: 100%; z-index: 100000; text-align: center; background-color: rgba(255,255,255,.75)">
|
2014-08-17 22:43:57 +00:00
|
|
|
<div style="margin: 20% auto">
|
2015-05-03 12:29:42 +00:00
|
|
|
<div><span class="fa fa-spinner fa-pulse"></span></div>
|
2014-08-17 22:43:57 +00:00
|
|
|
<div>Loading...</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div id="global_modal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="errorModalTitle" aria-hidden="true">
|
|
|
|
<div class="modal-dialog modal-sm">
|
|
|
|
<div class="modal-content">
|
|
|
|
<div class="modal-header">
|
|
|
|
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
|
|
|
<h4 class="modal-title" id="errorModalTitle"> </h4>
|
|
|
|
</div>
|
|
|
|
<div class="modal-body">
|
|
|
|
<p> </p>
|
|
|
|
</div>
|
|
|
|
<div class="modal-footer">
|
|
|
|
<button type="button" class="btn btn-default" data-dismiss="modal">OK</button>
|
|
|
|
<button type="button" class="btn btn-danger" data-dismiss="modal">Yes</button>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
2017-05-23 23:22:53 +00:00
|
|
|
<script src="/admin/assets/jquery.min.js"></script>
|
2017-05-31 11:36:17 +00:00
|
|
|
<script src="/admin/assets/bootstrap/js/bootstrap.min.js"></script>
|
2014-08-17 22:43:57 +00:00
|
|
|
|
|
|
|
<script>
|
|
|
|
var global_modal_state = null;
|
|
|
|
var global_modal_funcs = null;
|
|
|
|
|
|
|
|
$(function() {
|
2014-09-21 17:24:01 +00:00
|
|
|
$('#global_modal').on('shown.bs.modal', function (e) {
|
|
|
|
// set focus to first input in the global modal's body
|
|
|
|
var input = $('#global_modal .modal-body input');
|
2015-07-25 11:47:10 +00:00
|
|
|
if (input.length > 0) $(input[0]).focus();
|
|
|
|
})
|
2014-08-17 22:43:57 +00:00
|
|
|
$('#global_modal .btn-danger').click(function() {
|
|
|
|
// Don't take action now. Wait for the modal to be totally hidden
|
|
|
|
// so that we don't attempt to show another modal while this one
|
|
|
|
// is closing.
|
|
|
|
global_modal_state = 0; // OK
|
|
|
|
})
|
|
|
|
$('#global_modal .btn-default').click(function() {
|
|
|
|
global_modal_state = 1; // Cancel
|
|
|
|
})
|
|
|
|
$('#global_modal').on('hidden.bs.modal', function (e) {
|
|
|
|
// do the cancel function
|
|
|
|
if (global_modal_state == null) global_modal_state = 1; // cancel if the user hit ESC or clicked outside of the modal
|
|
|
|
if (global_modal_funcs && global_modal_funcs[global_modal_state])
|
|
|
|
global_modal_funcs[global_modal_state]();
|
2017-05-08 11:25:16 +00:00
|
|
|
})
|
2014-08-17 22:43:57 +00:00
|
|
|
})
|
|
|
|
|
|
|
|
function show_modal_error(title, message, callback) {
|
|
|
|
$('#global_modal h4').text(title);
|
|
|
|
$('#global_modal .modal-body').html("<p/>");
|
2015-04-19 13:08:53 +00:00
|
|
|
if (typeof question == 'string') {
|
2014-08-17 22:43:57 +00:00
|
|
|
$('#global_modal p').text(message);
|
|
|
|
$('#global_modal .modal-dialog').addClass("modal-sm");
|
|
|
|
} else {
|
|
|
|
$('#global_modal p').html("").append(message);
|
|
|
|
$('#global_modal .modal-dialog').removeClass("modal-sm");
|
|
|
|
}
|
|
|
|
$('#global_modal .btn-default').show().text("OK");
|
|
|
|
$('#global_modal .btn-danger').hide();
|
|
|
|
global_modal_funcs = [callback, callback];
|
|
|
|
global_modal_state = null;
|
|
|
|
$('#global_modal').modal({});
|
2015-04-11 19:39:35 +00:00
|
|
|
return false; // handy when called from onclick
|
2014-08-17 22:43:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function show_modal_confirm(title, question, verb, yes_callback, cancel_callback) {
|
|
|
|
$('#global_modal h4').text(title);
|
2015-04-19 13:08:53 +00:00
|
|
|
if (typeof question == 'string') {
|
2014-08-17 22:43:57 +00:00
|
|
|
$('#global_modal .modal-dialog').addClass("modal-sm");
|
|
|
|
$('#global_modal .modal-body').html("<p/>");
|
|
|
|
$('#global_modal p').text(question);
|
|
|
|
} else {
|
|
|
|
$('#global_modal .modal-dialog').removeClass("modal-sm");
|
|
|
|
$('#global_modal .modal-body').html("").append(question);
|
|
|
|
}
|
2015-04-19 13:08:53 +00:00
|
|
|
if (typeof verb == 'string') {
|
2015-04-11 19:39:35 +00:00
|
|
|
$('#global_modal .btn-default').show().text("Cancel");
|
|
|
|
$('#global_modal .btn-danger').show().text(verb);
|
|
|
|
} else {
|
|
|
|
$('#global_modal .btn-default').show().text(verb[1]);
|
|
|
|
$('#global_modal .btn-danger').show().text(verb[0]);
|
|
|
|
}
|
2014-08-17 22:43:57 +00:00
|
|
|
global_modal_funcs = [yes_callback, cancel_callback];
|
|
|
|
global_modal_state = null;
|
|
|
|
$('#global_modal').modal({});
|
2015-04-11 19:39:35 +00:00
|
|
|
return false; // handy when called from onclick
|
2014-08-17 22:43:57 +00:00
|
|
|
}
|
|
|
|
|
2014-12-21 22:47:11 +00:00
|
|
|
var ajax_num_executing_requests = 0;
|
2015-09-04 22:40:56 +00:00
|
|
|
function ajax_with_indicator(options) {
|
2014-12-21 22:47:11 +00:00
|
|
|
setTimeout("if (ajax_num_executing_requests > 0) $('#ajax_loading_indicator').fadeIn()", 100);
|
2014-08-17 22:43:57 +00:00
|
|
|
function hide_loading_indicator() {
|
2014-12-21 22:47:11 +00:00
|
|
|
ajax_num_executing_requests--;
|
|
|
|
if (ajax_num_executing_requests == 0)
|
2015-05-03 12:24:26 +00:00
|
|
|
$('#ajax_loading_indicator').stop(true).hide(); // stop() prevents an ongoing fade from causing the thing to be shown again after this call
|
2014-08-17 22:43:57 +00:00
|
|
|
}
|
|
|
|
var old_success = options.success;
|
|
|
|
var old_error = options.error;
|
|
|
|
options.success = function(data) {
|
|
|
|
hide_loading_indicator();
|
|
|
|
if (data.status == "error")
|
|
|
|
show_modal_error("Error", data.message);
|
|
|
|
else if (old_success)
|
|
|
|
old_success(data);
|
|
|
|
};
|
|
|
|
options.error = function(jqxhr) {
|
|
|
|
hide_loading_indicator();
|
2017-05-08 11:25:16 +00:00
|
|
|
if (!old_error)
|
2014-08-17 22:43:57 +00:00
|
|
|
show_modal_error("Error", "Something went wrong, sorry.")
|
|
|
|
else
|
2014-10-11 16:49:50 +00:00
|
|
|
old_error(jqxhr.responseText, jqxhr);
|
2014-08-17 22:43:57 +00:00
|
|
|
};
|
2014-12-21 22:47:11 +00:00
|
|
|
ajax_num_executing_requests++;
|
2014-08-17 22:43:57 +00:00
|
|
|
$.ajax(options);
|
2015-04-11 19:39:35 +00:00
|
|
|
return false; // handy when called from onclick
|
2014-08-17 22:43:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
var api_credentials = ["", ""];
|
2020-09-02 15:23:32 +00:00
|
|
|
function api(url, method, data, callback, callback_error, headers) {
|
2014-08-17 22:43:57 +00:00
|
|
|
// from http://www.webtoolkit.info/javascript-base64.html
|
|
|
|
function base64encode(input) {
|
|
|
|
_keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
|
|
|
|
var output = "";
|
|
|
|
var chr1, chr2, chr3, enc1, enc2, enc3, enc4;
|
|
|
|
var i = 0;
|
|
|
|
while (i < input.length) {
|
|
|
|
chr1 = input.charCodeAt(i++);
|
|
|
|
chr2 = input.charCodeAt(i++);
|
|
|
|
chr3 = input.charCodeAt(i++);
|
|
|
|
enc1 = chr1 >> 2;
|
|
|
|
enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
|
|
|
|
enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
|
|
|
|
enc4 = chr3 & 63;
|
|
|
|
if (isNaN(chr2)) {
|
|
|
|
enc3 = enc4 = 64;
|
|
|
|
} else if (isNaN(chr3)) {
|
|
|
|
enc4 = 64;
|
|
|
|
}
|
|
|
|
output = output +
|
|
|
|
_keyStr.charAt(enc1) + _keyStr.charAt(enc2) +
|
|
|
|
_keyStr.charAt(enc3) + _keyStr.charAt(enc4);
|
|
|
|
}
|
|
|
|
|
|
|
|
return output;
|
|
|
|
}
|
|
|
|
|
2014-10-11 16:49:50 +00:00
|
|
|
function default_error(text, xhr) {
|
|
|
|
if (xhr.status != 403) // else handled below
|
|
|
|
show_modal_error("Error", "Something went wrong, sorry.")
|
|
|
|
}
|
|
|
|
|
2015-09-04 22:40:56 +00:00
|
|
|
ajax_with_indicator({
|
2014-08-17 22:43:57 +00:00
|
|
|
url: "/admin" + url,
|
|
|
|
method: method,
|
2015-03-31 14:52:11 +00:00
|
|
|
cache: false,
|
2014-08-17 22:43:57 +00:00
|
|
|
data: data,
|
2020-09-02 15:23:32 +00:00
|
|
|
headers: headers,
|
2015-05-03 13:40:52 +00:00
|
|
|
// the custom DNS api sends raw POST/PUT bodies --- prevent URL-encoding
|
|
|
|
processData: typeof data != "string",
|
|
|
|
mimeType: typeof data == "string" ? "text/plain; charset=ascii" : null,
|
|
|
|
|
2014-08-17 22:43:57 +00:00
|
|
|
beforeSend: function(xhr) {
|
|
|
|
// We don't store user credentials in a cookie to avoid the hassle of CSRF
|
|
|
|
// attacks. The Authorization header only gets set in our AJAX calls triggered
|
|
|
|
// by user actions.
|
|
|
|
xhr.setRequestHeader(
|
|
|
|
'Authorization',
|
|
|
|
'Basic ' + base64encode(api_credentials[0] + ':' + api_credentials[1]));
|
|
|
|
},
|
|
|
|
success: callback,
|
2014-10-11 16:49:50 +00:00
|
|
|
error: callback_error || default_error,
|
2014-08-17 22:43:57 +00:00
|
|
|
statusCode: {
|
|
|
|
403: function(xhr) {
|
|
|
|
// Credentials are no longer valid. Try to login again.
|
|
|
|
var p = current_panel;
|
|
|
|
show_panel('login');
|
|
|
|
switch_back_to_panel = p;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
var current_panel = null;
|
|
|
|
var switch_back_to_panel = null;
|
2020-09-12 14:34:06 +00:00
|
|
|
|
|
|
|
function do_logout() {
|
2021-08-22 20:07:16 +00:00
|
|
|
// Clear the session from the backend.
|
|
|
|
api("/logout", "POST");
|
|
|
|
|
|
|
|
// Forget the token.
|
2020-09-12 14:34:06 +00:00
|
|
|
api_credentials = ["", ""];
|
|
|
|
if (typeof localStorage != 'undefined')
|
|
|
|
localStorage.removeItem("miab-cp-credentials");
|
|
|
|
if (typeof sessionStorage != 'undefined')
|
|
|
|
sessionStorage.removeItem("miab-cp-credentials");
|
2021-08-22 20:07:16 +00:00
|
|
|
|
|
|
|
// Return to the start.
|
2020-09-12 14:34:06 +00:00
|
|
|
show_panel('login');
|
|
|
|
}
|
|
|
|
|
2014-08-17 22:43:57 +00:00
|
|
|
function show_panel(panelid) {
|
|
|
|
if (panelid.getAttribute)
|
|
|
|
// we might be passed an HTMLElement <a>.
|
|
|
|
panelid = panelid.getAttribute('href').substring(1);
|
|
|
|
|
2014-10-21 11:01:23 +00:00
|
|
|
$('.admin_panel').hide();
|
2014-08-17 22:43:57 +00:00
|
|
|
$('#panel_' + panelid).show();
|
|
|
|
if (typeof localStorage != 'undefined')
|
|
|
|
localStorage.setItem("miab-cp-lastpanel", panelid);
|
|
|
|
if (window["show_" + panelid])
|
|
|
|
window["show_" + panelid]();
|
|
|
|
|
|
|
|
current_panel = panelid;
|
|
|
|
switch_back_to_panel = null;
|
|
|
|
|
|
|
|
return false; // when called from onclick, cancel navigation
|
|
|
|
}
|
|
|
|
|
|
|
|
$(function() {
|
|
|
|
// Recall saved user credentials.
|
|
|
|
if (typeof sessionStorage != 'undefined' && sessionStorage.getItem("miab-cp-credentials"))
|
|
|
|
api_credentials = sessionStorage.getItem("miab-cp-credentials").split(":");
|
|
|
|
else if (typeof localStorage != 'undefined' && localStorage.getItem("miab-cp-credentials"))
|
|
|
|
api_credentials = localStorage.getItem("miab-cp-credentials").split(":");
|
|
|
|
|
|
|
|
// Recall what the user was last looking at.
|
|
|
|
if (typeof localStorage != 'undefined' && localStorage.getItem("miab-cp-lastpanel")) {
|
|
|
|
show_panel(localStorage.getItem("miab-cp-lastpanel"));
|
|
|
|
} else {
|
|
|
|
show_panel('login');
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
</script>
|
|
|
|
</body>
|
|
|
|
</html>
|