luci-0.10: merge r8792
[project/luci.git] / libs / sys / luasrc / sys.lua
index 9c30f55f6cf167cf58e9eb9ccc9a012449b229e9..75b6cb4a2d05308a4669b17fdeba9e5ea3de324b 100644 (file)
@@ -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.