luci-base: prevent CBI map save on invalid values (#618)
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
This commit is contained in:
parent
eaf961fa70
commit
27281dca56
1 changed files with 34 additions and 30 deletions
|
@ -385,6 +385,7 @@ function Map.parse(self, readinput, ...)
|
||||||
|
|
||||||
Node.parse(self, ...)
|
Node.parse(self, ...)
|
||||||
|
|
||||||
|
if self.save then
|
||||||
self:_run_hooks("on_save", "on_before_save")
|
self:_run_hooks("on_save", "on_before_save")
|
||||||
for i, config in ipairs(self.parsechain) do
|
for i, config in ipairs(self.parsechain) do
|
||||||
self.uci:save(config)
|
self.uci:save(config)
|
||||||
|
@ -418,8 +419,11 @@ function Map.parse(self, readinput, ...)
|
||||||
if type(self.commit_handler) == "function" then
|
if type(self.commit_handler) == "function" then
|
||||||
self:commit_handler(self:submitstate())
|
self:commit_handler(self:submitstate())
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
if self.proceed then
|
if not self.save then
|
||||||
|
self.state = FORM_INVALID
|
||||||
|
elseif self.proceed then
|
||||||
self.state = FORM_PROCEED
|
self.state = FORM_PROCEED
|
||||||
elseif self.changed then
|
elseif self.changed then
|
||||||
self.state = FORM_CHANGED
|
self.state = FORM_CHANGED
|
||||||
|
|
Loading…
Reference in a new issue