luci-app-radicale2: Avoid losing password hash

This fixes a case where one could lose an already exising password hash
when changing another users' password or creating a new user.

Signed-off-by: Daniel F. Dickinson <cshored@thecshore.com>
This commit is contained in:
Daniel F. Dickinson 2019-01-16 19:11:26 -05:00
parent 8fc68bee2c
commit 8a72536448

View file

@ -135,33 +135,19 @@ function encpass(self, section)
return encvalue and encvalue.encrypted_password return encvalue and encvalue.encrypted_password
end end
pass.parse = function(self, section, novld) pass.cfgvalue = function(self, section)
local encvalue if not plainpass:formvalue(section) then
if self:cfgvalue(section) then return Value.cfgvalue(self, section)
if not plainpass:cfgvalue(section) then
return Value.parse(self, section)
else
encvalue = encpass(self, section)
if encvalue then
self.formvalue = function(self, section)
return encvalue
end
return Value.parse(self, section, novld)
else
self.formvalue = self.cfgvalue
return Value.parse(self, section, novld)
end
end
else else
encvalue = encpass(self, section) return Value.formvalue(self, section)
if encvalue then end
self.formvalue = function(self, section) end
return encvalue
end pass.formvalue = function(self, section)
return Value.parse(self, section, novld) if not plainpass:formvalue(section) then
else return Value.formvalue(self, section)
return nil else
end return encpass(self, section) or Value.formvalue(self, section)
end end
end end