From e2507e1affe8c092238f88f08a097413ef090e83 Mon Sep 17 00:00:00 2001 From: Mika Havela Date: Mon, 10 Aug 2009 10:01:57 +0000 Subject: Force name of new config-files to end with '.conf' --- openvpn-model.lua | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'openvpn-model.lua') diff --git a/openvpn-model.lua b/openvpn-model.lua index 075591f..c324353 100644 --- a/openvpn-model.lua +++ b/openvpn-model.lua @@ -226,7 +226,7 @@ end function create_new_config() config = { - name = cfe({ label="File Name" }), + name = cfe({ label="File Name", descr="File name should end with \".conf\"" }), } return cfe({ type="group", value=config, label="Config" }) @@ -245,6 +245,9 @@ function create_config(config) elseif posix.stat(path) then success = false config.value.name.errtxt = "File already exists" + elseif not string.match(path,".*conf") then + success = false + config.value.name.errtxt = "Filename must end with '.conf'" end if success then -- cgit v1.2.3