libs/sys: fix logic fail in luci.sys.user.checkpasswd() (#152)
[project/luci.git] / libs / sys / luasrc / sys.lua
index 6d000ae..d4242a3 100644 (file)
@@ -604,7 +604,7 @@ end
 -- @return                     Boolean indicating wheather the passwords are equal
 function user.checkpasswd(username, pass)
        local pwh = user.getpasswd(username)
-       if not pwh or nixio.crypt(pass, pwh) ~= pwh then
+       if pwh and nixio.crypt(pass, pwh) ~= pwh then
                return false
        else
                return true