2 Copyright 2008 Steven Barth <steven@midlink.org>
3 Copyright 2008-2012 Jo-Philipp Wich <jow@openwrt.org>
4 Licensed to the public under the Apache License 2.0.
9 <form method="post" action="<%=pcdata(luci.http.getenv("REQUEST_URI"))%>">
11 <h2 name="content"><%:Authorization Required%></h2>
12 <div class="cbi-map-descr">
13 <%:Please enter your username and password.%>
15 <div class="error"><%:Invalid username and/or password! Please try again.%></div>
19 <fieldset class="cbi-section"><fieldset class="cbi-section-node">
20 <div class="cbi-value">
21 <label class="cbi-value-title"><%:Username%></label>
22 <div class="cbi-value-field">
23 <input class="cbi-input-user" type="text" name="luci_username" value="<%=duser%>" />
26 <div class="cbi-value cbi-value-last">
27 <label class="cbi-value-title"><%:Password%></label>
28 <div class="cbi-value-field">
29 <input class="cbi-input-password" type="password" name="luci_password" />
32 </fieldset></fieldset>
36 <input type="submit" value="<%:Login%>" class="cbi-button cbi-button-apply" />
37 <input type="reset" value="<%:Reset%>" class="cbi-button cbi-button-reset" />
40 <script type="text/javascript">//<![CDATA[
41 var input = document.getElementsByName('luci_password')[0];
47 local uci = require "luci.model.uci".cursor()
48 local fs = require "nixio.fs"
49 local https_key = uci:get("uhttpd", "main", "key")
50 local https_port = uci:get("uhttpd", "main", "listen_https")
51 if type(https_port) == "table" then
52 https_port = https_port[1]
55 if https_port and fs.access(https_key) then
56 https_port = https_port:match("(%d+)$")
59 <script type="text/javascript">//<![CDATA[
60 if (document.location.protocol != 'https:') {
61 var url = 'https://' + window.location.hostname + ':' + '<%=https_port%>' + window.location.pathname;
63 img.onload=function(){window.location = url};
64 img.src='https://' + window.location.hostname + ':' + '<%=https_port%>' + '<%=resource%>/cbi/up.gif?' + Math.random();;
65 setTimeout(function(){