From 8a725364481b25a14829ea8e28867d560b01189a Mon Sep 17 00:00:00 2001 From: "Daniel F. Dickinson" Date: Wed, 16 Jan 2019 19:11:26 -0500 Subject: 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 --- .../luasrc/model/cbi/radicale2/auth.lua | 38 +++++++--------------- 1 file changed, 12 insertions(+), 26 deletions(-) (limited to 'applications') 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 -- cgit v1.2.3 From 11cff5374ba8287a6671a68c8eb4f228714c9e98 Mon Sep 17 00:00:00 2001 From: "Daniel F. Dickinson" Date: Wed, 16 Jan 2019 19:13:01 -0500 Subject: luci-app-radicale2: Use http when not SSL The test or whether we were using SSL often returned true even when using HTTP only, therefore fix the test. Signed-off-by: Daniel F. Dickinson --- applications/luci-app-radicale2/luasrc/view/cbi/raduigo.htm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'applications') diff --git a/applications/luci-app-radicale2/luasrc/view/cbi/raduigo.htm b/applications/luci-app-radicale2/luasrc/view/cbi/raduigo.htm index 2f449d7b0b..1bcf388bd6 100644 --- a/applications/luci-app-radicale2/luasrc/view/cbi/raduigo.htm +++ b/applications/luci-app-radicale2/luasrc/view/cbi/raduigo.htm @@ -1,7 +1,7 @@ <% local uci = require "luci.model.uci".cursor() local http_port = uci:get("radicale2", "server", "host") -local usessl = uci:get("radicale2", "server", "ssl") +local usessl = uci:get_bool("radicale2", "server", "ssl") if type(http_port) == "table" then http_port = http_port[1] end -- cgit v1.2.3