1 -- Copyright 2008 Steven Barth <steven@midlink.org>
2 -- Copyright 2008 Jo-Philipp Wich <jow@openwrt.org>
3 -- Licensed to the public under the Apache License 2.0.
5 f = SimpleForm("password", translate("Admin Password"), translate("Change the password of the system administrator (User <code>root</code>)"))
7 pw1 = f:field(Value, "pw1", translate("Password"))
11 pw2 = f:field(Value, "pw2", translate("Confirmation"))
15 function pw2.validate(self, value, section)
16 return pw1:formvalue(section) == value and value
19 function f.handle(self, state, data)
20 if state == FORM_VALID then
21 local stat = luci.sys.user.setpasswd("root", data.pw1) == 0
24 f.message = translate("Password successfully changed")
26 f.errmessage = translate("Unknown Error")