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(FULL_REQUEST_URI)%>">
11 <div class="alert-message warning">
12 <p><%:Invalid username and/or password! Please try again.%></p>
17 <h2 name="content"><%:Authorization Required%></h2>
18 <div class="cbi-map-descr">
19 <%:Please enter your username and password.%>
21 <div class="cbi-section"><div class="cbi-section-node">
22 <div class="cbi-value">
23 <label class="cbi-value-title"><%:Username%></label>
24 <div class="cbi-value-field">
25 <input class="cbi-input-text" type="text" name="luci_username" value="<%=duser%>" />
28 <div class="cbi-value cbi-value-last">
29 <label class="cbi-value-title"><%:Password%></label>
30 <div class="cbi-value-field">
31 <input class="cbi-input-text" type="password" name="luci_password" />
37 <div class="cbi-page-actions">
38 <input type="submit" value="<%:Login%>" class="cbi-button cbi-button-apply" />
39 <input type="reset" value="<%:Reset%>" class="cbi-button cbi-button-reset" />
42 <script type="text/javascript">//<![CDATA[
43 var input = document.getElementsByName('luci_password')[0];
49 local uci = require "luci.model.uci".cursor()
50 local fs = require "nixio.fs"
51 local https_key = uci:get("uhttpd", "main", "key")
52 local https_port = uci:get("uhttpd", "main", "listen_https")
53 if type(https_port) == "table" then
54 https_port = https_port[1]
57 if https_port and fs.access(https_key) then
58 https_port = https_port:match("(%d+)$")
61 <script type="text/javascript">//<![CDATA[
62 if (document.location.protocol != 'https:') {
63 var url = 'https://' + window.location.hostname + ':' + '<%=https_port%>' + window.location.pathname;
65 img.onload=function(){window.location = url};
66 img.src='https://' + window.location.hostname + ':' + '<%=https_port%>' + '<%=resource%>/cbi/up.gif?' + Math.random();;
67 setTimeout(function(){