summaryrefslogtreecommitdiffhomepage
path: root/libs/sys/luasrc/sys.lua
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2012-06-27 13:52:09 +0000
committerJo-Philipp Wich <jow@openwrt.org>2012-06-27 13:52:09 +0000
commitb1617b3718c3819a4eeeef5db62b9e05ffc96812 (patch)
treedeabb331ffb34e003e9b3b28de498b4ccdfaaf97 /libs/sys/luasrc/sys.lua
parentd30109e350b9804bb2e1d33b987250ea10a05f6b (diff)
libs/sys: fix luci.sys.checkpasswd() semantics
Diffstat (limited to 'libs/sys/luasrc/sys.lua')
-rw-r--r--libs/sys/luasrc/sys.lua7
1 files changed, 3 insertions, 4 deletions
diff --git a/libs/sys/luasrc/sys.lua b/libs/sys/luasrc/sys.lua
index 54f7f2b1a9..18c79119f7 100644
--- a/libs/sys/luasrc/sys.lua
+++ b/libs/sys/luasrc/sys.lua
@@ -612,11 +612,10 @@ end
-- @return Boolean indicating wheather the passwords are equal
function user.checkpasswd(username, pass)
local pwh = user.getpasswd(username)
- if pwh and nixio.crypt(pass, pwh) ~= pwh then
- return false
- else
- return true
+ if pwh then
+ return (nixio.crypt(pass, pwh) == pwh)
end
+ return false
end
--- Change the password of given user.