2 LuCI - Lua Configuration Interface
3 Copyright 2008 Steven Barth <steven@midlink.org>
4 Copyright 2008-2012 Jo-Philipp Wich <xm@subsignal.org>
6 Licensed under the Apache License, Version 2.0 (the "License");
7 you may not use this file except in compliance with the License.
8 You may obtain a copy of the License at
10 http://www.apache.org/licenses/LICENSE-2.0
16 <form method="post" action="<%=pcdata(luci.http.getenv("REQUEST_URI"))%>">
18 <h2><a id="content" name="content"><%:Authorization Required%></a></h2>
19 <div class="cbi-map-descr">
20 <%:Please enter your username and password.%>
22 <div class="error"><%:Invalid username and/or password! Please try again.%></div>
26 <fieldset class="cbi-section"><fieldset class="cbi-section-node">
27 <div class="cbi-value">
28 <label class="cbi-value-title"><%:Username%></label>
29 <div class="cbi-value-field">
30 <input class="cbi-input-user" type="text" name="luci_username" value="<%=duser%>" />
33 <div class="cbi-value cbi-value-last">
34 <label class="cbi-value-title"><%:Password%></label>
35 <div class="cbi-value-field">
36 <input class="cbi-input-password" type="password" name="luci_password" />
39 </fieldset></fieldset>
43 <input type="submit" value="<%:Login%>" class="cbi-button cbi-button-apply" />
44 <input type="reset" value="<%:Reset%>" class="cbi-button cbi-button-reset" />
47 <script type="text/javascript">//<![CDATA[
48 var input = document.getElementsByName('luci_password')[0];
54 local uci = require "luci.model.uci".cursor()
55 local fs = require "nixio.fs"
56 local https_key = uci:get("uhttpd", "main", "key")
57 local https_port = uci:get("uhttpd", "main", "listen_https")
58 if type(https_port) == "table" then
59 https_port = https_port[1]
62 if https_port and fs.access(https_key) then
63 https_port = https_port:match("(%d+)$")
66 <script type="text/javascript">//<![CDATA[
67 if (document.location.protocol != 'https:') {
68 var url = 'https://' + window.location.hostname + ':' + '<%=https_port%>' + window.location.pathname;
70 img.onload=function(){window.location = url};
71 img.src='https://' + window.location.hostname + ':' + '<%=https_port%>' + '<%=resource%>/cbi/up.gif?' + Math.random();;
72 setTimeout(function(){