luci-mod-admin-full: fix empty SSH-Keys issue
If you delete all ssh keys in the textarea then LuCI will rais an error. So if you added one ssh-key to the textarea and then you want to delete them again that is not possbile in LuCI. To fix this remove "rmempty" attribute and add a remove function which will called if the textarea is empty. Signed-off-by: Florian Eckert <fe@dev.tdt.de>
This commit is contained in:
parent
b5a43cf87d
commit
0251603f0a
1 changed files with 5 additions and 4 deletions
|
@ -104,16 +104,17 @@ end
|
||||||
keys = s2:option(TextValue, "_data", "")
|
keys = s2:option(TextValue, "_data", "")
|
||||||
keys.wrap = "off"
|
keys.wrap = "off"
|
||||||
keys.rows = 3
|
keys.rows = 3
|
||||||
keys.rmempty = false
|
|
||||||
|
|
||||||
function keys.cfgvalue()
|
function keys.cfgvalue()
|
||||||
return fs.readfile("/etc/dropbear/authorized_keys") or ""
|
return fs.readfile("/etc/dropbear/authorized_keys") or ""
|
||||||
end
|
end
|
||||||
|
|
||||||
function keys.write(self, section, value)
|
function keys.write(self, section, value)
|
||||||
if value then
|
return fs.writefile("/etc/dropbear/authorized_keys", value:gsub("\r\n", "\n"))
|
||||||
fs.writefile("/etc/dropbear/authorized_keys", value:gsub("\r\n", "\n"))
|
end
|
||||||
end
|
|
||||||
|
function keys.remove(self, section, value)
|
||||||
|
return fs.writefile("/etc/dropbear/authorized_keys", "")
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue