2 LuCI - Lua Configuration Interface
4 Copyright 2008 Steven Barth <steven@midlink.org>
5 Copyright 2008 Jo-Philipp Wich <xm@leipzig.freifunk.net>
7 Licensed under the Apache License, Version 2.0 (the "License");
8 you may not use this file except in compliance with the License.
9 You may obtain a copy of the License at
11 http://www.apache.org/licenses/LICENSE-2.0
15 f = SimpleForm("password", translate("a_s_changepw"), translate("a_s_changepw1"))
17 pw1 = f:field(Value, "pw1", translate("password"))
20 pw2 = f:field(Value, "pw2", translate("confirmation"))
23 function pw2.validate(self, value, section)
24 return pw1:formvalue(section) == value and value
27 function f.handle(self, state, data)
28 if state == FORM_VALID then
29 local stat = luci.sys.user.setpasswd("root", data.pw1) == 0
32 f.message = translate("a_s_changepw_changed")
34 f.errmessage = translate("unknownerror")