luci/modules/luci-mod-system
Jo-Philipp Wich 1c09ee5e42 luci-mod-system: fix SimpleForm usage on file editing pages
When a value identical to the stored one is submitted, the CBI framework
will not emit an option write event and therfore not store the value in
the form data dictionary passed to SimpleForm.handle().

This usage pattern usally works be accident for file editor views such
as admin_system/crontab because \r\n windows style line endings are
substituted with unix \n ones before writing the data, defeating the
equality check in CBI.

When a single line without trailing newline is submitted however, the
CBI will not see a difference to the data stored in the file and clear
out the value on subsequent saves.

This commit alignes the logic used by various SimpleForm views to
behave identically and predictable:

 - File data is handled in the SimpleForm.handle() callback
 - The forcewrite property is used to disable equality checks
 - Submission of an empty string empties the backing file

Fixes: #2737
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-06-05 16:15:40 +02:00
..
htdocs/luci-static/resources/view/system luci-mod-system: move password and sshkey JS code into external files 2018-11-22 12:49:14 +01:00
luasrc luci-mod-system: fix SimpleForm usage on file editing pages 2019-06-05 16:15:40 +02:00
Makefile modules: Split luci-mod-full 2018-09-19 20:08:19 +02:00