mirror of
https://github.com/ntop/ntopng.git
synced 2026-05-10 00:42:14 +00:00
Adds bootstrap-5.0.0-beta3-dist Adds bootstrap-5.0.0 Updates bootstrap-5.0.0-beta3-dist to bootstrap-5.0.0-dist initial migration to bs v5 porting to bs5 improvements on dropdown menu filter fixed host map dropdown removed excessive padding fix button toggle re-add blog news removed text decoration for links fix button layout (#5348) remove underscore from href (#5347)
161 lines
6.1 KiB
Lua
161 lines
6.1 KiB
Lua
--
|
|
-- (C) 2013-21 - ntop.org
|
|
--
|
|
|
|
local dirs = ntop.getDirs()
|
|
package.path = dirs.installdir .. "/scripts/lua/modules/?.lua;" .. package.path
|
|
-- io.write ("Session:".._SESSION["session"].."\n")
|
|
require "lua_utils"
|
|
|
|
local page_utils = require("page_utils")
|
|
|
|
sendHTTPContentTypeHeader('text/html')
|
|
|
|
page_utils.print_header()
|
|
|
|
local info = ntop.getInfo()
|
|
|
|
local referer = _GET["referer"]
|
|
local reason = _GET["reason"]
|
|
|
|
print ([[
|
|
<script src=']].. ntop.getHttpPrefix() ..[[/js/particle/particle.min.js'></script>
|
|
<style>
|
|
|
|
html, body {
|
|
height: 100vh;
|
|
}
|
|
|
|
body {
|
|
background-color: #f5f5f5;
|
|
display: flex;
|
|
align-items: center;
|
|
padding-top: 40px;
|
|
padding-bottom: 40px;
|
|
background-color: #f5f5f5;
|
|
padding-top: 0 !important;
|
|
text-align: center;
|
|
}
|
|
|
|
#particles-js {
|
|
position: absolute;
|
|
width: 100%;
|
|
height: 100%;
|
|
background-color: #f5f5f5;
|
|
background-image: url("");
|
|
background-repeat: no-repeat;
|
|
background-size: cover;
|
|
background-position: 50% 50%;
|
|
} /* ---- stats.js ---- */
|
|
|
|
.form-signin {
|
|
width: 100%;
|
|
max-width: 330px;
|
|
padding: 15px;
|
|
margin: auto;
|
|
z-index: 1000;
|
|
}
|
|
</style>
|
|
<div id="particles-js"></div>
|
|
<main class='form-signin'>
|
|
]])
|
|
|
|
local blacklisted = ntop.isLoginBlacklisted()
|
|
|
|
-- must specify the accept-charset here or the encoding for the special characters will be different from the encoding used when saving/updating passwords
|
|
print[[
|
|
<form id="form_add_user" role="form" data-bs-toggle="validator" onsubmit="return makeUsernameLowercase();" action="]] print(ntop.getHttpPrefix()) print[[/authorize.html" method="POST" accept-charset="UTF-8">
|
|
|
|
<input type="hidden" class="form-control" name="user">
|
|
<input type="hidden" class="form-control" name="referer" value="]] print(referer or "") print [[">
|
|
|
|
<h1 class="h3 mb-3 fw-normal">]] print(i18n("login.welcome_to", {product=info["product"]})) print[[</h1>
|
|
<div class="form-group mb-3 has-feedback mb-3">
|
|
<div class='form-floating'>
|
|
<input placeholder='admin' id='input-username' type="text" class="form-control" name="_username" required]] print(ternary(blacklisted, " disabled", "")) print[[>
|
|
<label for="input-username">]] print(i18n("login.username_ph")) print[[
|
|
</div>
|
|
<div class='form-floating'>
|
|
<input placeholder='admin' id='input-password' type="password" class="form-control" name="password" pattern="]] print(getPasswordInputPattern()) print[[" required]] print(ternary(blacklisted, " disabled", "")) print[[>
|
|
<label for="input-password">]] print(i18n("login.password_ph")) print[[
|
|
</div>
|
|
]]
|
|
|
|
if blacklisted then
|
|
print[[
|
|
<span class="text-danger">]] print(i18n("login.blacklisted_ip_notice")) print[[</span>
|
|
]]
|
|
end
|
|
|
|
if not isEmptyString(reason) then
|
|
print[[
|
|
<span class="text-danger">]] print(i18n("login."..reason)) print[[</span>
|
|
]]
|
|
end
|
|
|
|
print[[
|
|
</div> <!-- Close .form-group mb-3 -->
|
|
<button class="w-100 btn btn-lg btn-primary" type="submit">]] print(i18n("login.login")) print[[</button>
|
|
<div class="row">
|
|
|
|
<div > </div>
|
|
<div class="col-lg-12"><small><center> <i class="fas fa-lock"></i> <A target="_blank" HREF="https://www.ntop.org/guides/ntopng/faq.html#cannot-login-into-the-gui">]]
|
|
print(i18n("login.unable_to_login"))
|
|
print [[</A> <i class='fas fa-external-link-alt'></i> </center></small></div>
|
|
<div > </div>
|
|
<div class="col-lg-12">]]
|
|
if not info.oem then
|
|
|
|
if(info["product"] == "ntopng") then
|
|
print[[<small>
|
|
<p>]] print(i18n("login.donation", {product=info["product"], donation_url="http://shop.ntop.org"})) print[[
|
|
</p>
|
|
|
|
<p class='text-muted'>]] print(info["copyright"]) print [[<br> ]] print(i18n("login.license", {product=info["product"], license="GPLv3", license_url="http://www.gnu.org/copyleft/gpl.html"})) print[[</p>
|
|
</small>]]
|
|
else
|
|
print("<small>"..info["copyright"].."</small>")
|
|
end
|
|
|
|
end
|
|
print[[<div id="unsupported-browser" style="display:none">
|
|
<b>]] print(i18n("traffic_profiles.note")) print[[</b>: <small>]] print(i18n("login.unsupported_browser")) print[[</small>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
|
|
<script>
|
|
$("input:text:visible:first").focus();
|
|
//$('#form_add_user').validator();
|
|
|
|
function makeUsernameLowercase() {
|
|
var target = $('#form_add_user input[name="user"]');
|
|
var origin = $('#form_add_user input[name="_username"]');
|
|
target.val(origin.val().toLowerCase());
|
|
origin.removeAttr("name");
|
|
return true;
|
|
}
|
|
|
|
function isIeBrowser() {
|
|
var ua = window.navigator.userAgent;
|
|
var msie = ua.indexOf("MSIE ");
|
|
|
|
if (msie > 0 || navigator.userAgent.match(/Trident.*rv\:11\./))
|
|
return true;
|
|
|
|
return false;
|
|
}
|
|
|
|
if(isIeBrowser()) $("#unsupported-browser").show();
|
|
</script>
|
|
<script type='text/javascript'>
|
|
particlesJS("particles-js", {"particles":{"number":{"value":20,"density":{"enable":true,"value_area":500}},"color":{"value":"#ccc"},"shape":{"type":"circle","stroke":{"width":0,"color":"#000000"},"polygon":{"nb_sides":5},"image":{"src":"img/github.svg","width":100,"height":100}},"opacity":{"value":1,"random":false,"anim":{"enable":false,"speed":1,"opacity_min":0.1,"sync":false}},"size":{"value":3,"random":true,"anim":{"enable":false,"speed":40,"size_min":0.1,"sync":false}},"line_linked":{"enable":true,"distance":150,"color":"#6e6e6e","opacity":0.4,"width":1},"move":{"enable":true,"speed":1,"direction":"none","random":false,"straight":false,"out_mode":"out","bounce":false,"attract":{"enable":false,"rotateX":600,"rotateY":1200}}},"interactivity":{"detect_on":"canvas","events":{"onhover":{"enable":false,"mode":"repulse"},"onclick":{"enable":false,"mode":"push"},"resize":true},"modes":{"grab":{"distance":400,"line_linked":{"opacity":1}},"bubble":{"distance":400,"size":40,"duration":2,"opacity":8,"speed":3},"repulse":{"distance":200,"duration":0.4},"push":{"particles_nb":4},"remove":{"particles_nb":2}}},"retina_detect":true});
|
|
</script>
|
|
|
|
</main>
|
|
<script type="text/javascript" src="]] print(ntop.getHttpPrefix()) print[[/bootstrap/js/bootstrap.min.js?"></script>
|
|
<script type="text/javascript" src="]] print(ntop.getHttpPrefix()) print[[/selectpicker/js/bootstrap-select.min.js"></script>
|
|
</body>
|
|
</html>
|
|
]]
|