summaryrefslogtreecommitdiffhomepage
path: root/modules/luci-mod-system/luasrc/view/admin_system/password.htm
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2018-11-21 20:04:55 +0100
committerJo-Philipp Wich <jo@mein.io>2018-11-22 12:49:14 +0100
commit84d50a604493a492c1cf836eccd349da66216e14 (patch)
treed7252131f01aaf94622e68b20492931b66301837 /modules/luci-mod-system/luasrc/view/admin_system/password.htm
parentb8e341c20ef88136180c95e3b2db9adf299eaf62 (diff)
luci-mod-system: move password and sshkey JS code into external files
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'modules/luci-mod-system/luasrc/view/admin_system/password.htm')
-rw-r--r--modules/luci-mod-system/luasrc/view/admin_system/password.htm37
1 files changed, 2 insertions, 35 deletions
diff --git a/modules/luci-mod-system/luasrc/view/admin_system/password.htm b/modules/luci-mod-system/luasrc/view/admin_system/password.htm
index db35fb01e8..09cea4f74a 100644
--- a/modules/luci-mod-system/luasrc/view/admin_system/password.htm
+++ b/modules/luci-mod-system/luasrc/view/admin_system/password.htm
@@ -1,40 +1,5 @@
<%+header%>
-<script type="application/javascript">//<![CDATA[
- function submitPassword(ev) {
- var pw1 = document.body.querySelector('[name="pw1"]'),
- pw2 = document.body.querySelector('[name="pw2"]');
-
- if (!pw1.value.length || !pw2.value.length)
- return;
-
- if (pw1.value === pw2.value) {
- showModal('<%:Change login password%>',
- E('p', { class: 'spinning' }, '<%:Changing password…%>'));
-
- (new XHR()).post('<%=url("admin/system/admin/password/json")%>',
- { token: '<%=token%>', password: pw1.value },
- function() {
- showModal('<%:Change login password%>', [
- E('div', _('The system password has been successfully changed.')),
- E('div', { 'class': 'right' },
- E('div', { class: 'btn', click: hideModal }, '<%:Dismiss%>'))
- ]);
-
- pw1.value = pw2.value = '';
- });
- }
- else {
- showModal('<%:Change login password%>', [
- E('div', { class: 'alert-message warning' },
- _('Given password confirmation did not match, password not changed!')),
- E('div', { 'class': 'right' },
- E('div', { class: 'btn', click: hideModal }, '<%:Dismiss%>'))
- ]);
- }
- }
-//]]></script>
-
<input type="password" aria-hidden="true" style="position:absolute; left:-10000px" />
<div class="cbi-map">
@@ -67,4 +32,6 @@
<button class="btn cbi-button-apply" onclick="submitPassword(event)"><%:Save%></button>
</div>
+<script type="application/javascript" src="<%=resource%>/view/system/password.js"></script>
+
<%+footer%>