libs/sys: fix luci.sys.checkpasswd() semantics
This commit is contained in:
parent
d30109e350
commit
b1617b3718
1 changed files with 3 additions and 4 deletions
|
@ -612,11 +612,10 @@ end
|
||||||
-- @return Boolean indicating wheather the passwords are equal
|
-- @return Boolean indicating wheather the passwords are equal
|
||||||
function user.checkpasswd(username, pass)
|
function user.checkpasswd(username, pass)
|
||||||
local pwh = user.getpasswd(username)
|
local pwh = user.getpasswd(username)
|
||||||
if pwh and nixio.crypt(pass, pwh) ~= pwh then
|
if pwh then
|
||||||
return false
|
return (nixio.crypt(pass, pwh) == pwh)
|
||||||
else
|
|
||||||
return true
|
|
||||||
end
|
end
|
||||||
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Change the password of given user.
|
--- Change the password of given user.
|
||||||
|
|
Loading…
Reference in a new issue