jerrykuku 124b8bf6b0 bump version to v2.2
- New login theme, Request background imge from bing.com, Auto change everyday.
- New theme icon
- Add more menu category  icon
- Fix font-size and padding margin
- Restructure css file
- Auto adapt to dark mode
2020-07-25 15:21:33 +08:00

86 lines
2.7 KiB
HTML

<%#
Copyright 2008 Steven Barth <steven@midlink.org>
Copyright 2008-2012 Jo-Philipp Wich <jow@openwrt.org>
Licensed to the public under the Apache License 2.0.
-%>
<%+header_login%>
<%
local util = require "luci.util"
local boardinfo = util.ubus("system", "board")
%>
<a class="brand" href="/"><img src="/luci-static/argon/img/argon.svg" class="icon"><span
class="brand-text"><%=striptags( (boardinfo.hostname or "?") .. ( (node and node.title) and ' - ' .. translate(node.title) or '')) %></span></a>
<form class="form-login" method="post" action="<%=pcdata(luci.http.getenv("REQUEST_URI"))%>">
<%- if fuser then %>
<div class="errorbox"><%:Invalid username and/or password! Please try again.%></div>
<% end -%>
<div class="input-container">
<div class="input-group user-icon">
<input class="cbi-input-user" id="cbi-input-user" type="text" name="luci_username" value="<%=duser%>" />
<label class="border" for="cbi-input-user"></label>
</div>
<div class="input-group pass-icon">
<input class="cbi-input-password" id="cbi-input-password" type="password" name="luci_password" />
<label class="border" for="cbi-input-password"></label>
</div>
</div>
<div>
<input type="submit" value="<%:Login%>" class="cbi-button cbi-button-apply" />
</div>
</form>
<%
local bing = string.gsub(luci.sys.exec("content=`wget --no-check-certificate -q -O - 'http://www.bing.com/HPImageArchive.aspx?format=js&idx=0&n=1&mkt=en-US'`;echo $content"), "\n", "")
%>
<script type="text/javascript">//<![CDATA[
var input = document.getElementsByName('luci_password')[0];
if (input)
input.focus();
try {
var bing = <%=bing%>;
var bg = "https://www.bing.com" + bing.images[0].url;
$(".login-page").css("background-image", "url(" + bg + ")");
} catch{
console.log("can not access bing api");
$(".login-page").css("background-image", "url(/luci-static/argon/img/bg1.jpg)");
}
//]]></script>
<%
local uci = require "luci.model.uci".cursor()
local fs = require "nixio.fs"
local https_key = uci:get("uhttpd", "main", "key")
local https_port = uci:get("uhttpd", "main", "listen_https")
if type(https_port) == "table" then
https_port = https_port[1]
end
if https_port and fs.access(https_key) then
https_port = https_port:match("(%d+)$")
%>
<script type="text/javascript">//<![CDATA[
if (document.location.protocol != 'https:') {
var url = 'https://' + window.location.hostname + ':' + '<%=https_port%>' + window.location.pathname;
var img = new Image;
img.onload = function () { window.location = url };
img.src = 'https://' + window.location.hostname + ':' + '<%=https_port%>' + '<%=resource%>/cbi/up.gif?' + Math.random();;
setTimeout(function () {
img.src = ''
}, 5000);
}
//]]></script>
<% end %>
<%+footer%>