diff options
author | Daniel F. Dickinson <cshored@thecshore.com> | 2019-01-16 19:11:26 -0500 |
---|---|---|
committer | Daniel F. Dickinson <cshored@thecshore.com> | 2019-01-16 19:11:28 -0500 |
commit | 8a725364481b25a14829ea8e28867d560b01189a (patch) | |
tree | a27458a0367ed379ec17e40822729952d8b5290f /applications/luci-app-radicale2/luasrc/model/cbi | |
parent | 8fc68bee2c43b57b24d4f6b6ffdc60ef52afc76b (diff) |
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>
Diffstat (limited to 'applications/luci-app-radicale2/luasrc/model/cbi')
-rw-r--r-- | applications/luci-app-radicale2/luasrc/model/cbi/radicale2/auth.lua | 38 |
1 files changed, 12 insertions, 26 deletions
diff --git a/applications/luci-app-radicale2/luasrc/model/cbi/radicale2/auth.lua b/applications/luci-app-radicale2/luasrc/model/cbi/radicale2/auth.lua index 71fd3a32ee..b352bb46aa 100644 --- a/applications/luci-app-radicale2/luasrc/model/cbi/radicale2/auth.lua +++ b/applications/luci-app-radicale2/luasrc/model/cbi/radicale2/auth.lua @@ -135,33 +135,19 @@ function encpass(self, section) return encvalue and encvalue.encrypted_password end -pass.parse = function(self, section, novld) - local encvalue - if self:cfgvalue(section) then - 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 +pass.cfgvalue = function(self, section) + if not plainpass:formvalue(section) then + return Value.cfgvalue(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 - return nil - end + return Value.formvalue(self, section) + end +end + +pass.formvalue = function(self, section) + if not plainpass:formvalue(section) then + return Value.formvalue(self, section) + else + return encpass(self, section) or Value.formvalue(self, section) end end |