summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--vmail-model.lua8
1 files changed, 4 insertions, 4 deletions
diff --git a/vmail-model.lua b/vmail-model.lua
index 3073c51..f329b27 100644
--- a/vmail-model.lua
+++ b/vmail-model.lua
@@ -38,7 +38,7 @@ local table_creation_scripts = {
"INSERT INTO voicemail_params VALUES(null, 'username', 'text', 'Extension', '', '')",
"INSERT INTO voicemail_params VALUES(null, 'firstname', 'text', 'User First Name', '', '')",
"INSERT INTO voicemail_params VALUES(null, 'lastname', 'text', 'User Last Name', '', '')",
- "INSERT INTO voicemail_params VALUES(null, 'vm-password', 'text', 'Voicemail Password', '', '')",
+ "INSERT INTO voicemail_params VALUES(null, 'vm-password', 'text', 'Voicemail Password', 'Passwords must be all numbers and at least three digits', '')",
"INSERT INTO voicemail_params VALUES(null, 'vm-password-confirm', 'text', 'Enter again to confirm', '', '')",
"INSERT INTO voicemail_params VALUES(null, 'vm-mailto', 'text', 'Email Address', 'Email a notification, including audio file if enabled', '')",
"INSERT INTO voicemail_params VALUES(null, 'vm-email-all-messages', 'boolean', 'Email Enable', '', 'false')",
@@ -697,11 +697,11 @@ update_usersettings = function(usersettings, create)
local success = true
local errtxt
-- Validate the settings
- if not validator.is_integer(usersettings.value["vm-password"].value) then
+ if usersettings.value["vm-password"] and not string.match(usersettings.value["vm-password"].value, "^%d%d%d+$") then
success = false
- usersettings.value["vm-password"].errtxt = "Password must be all numbers"
+ usersettings.value["vm-password"].errtxt = "Passwords must be all numbers and at least three digits"
end
- if usersettings.value["vm-password"].value ~= usersettings.value["vm-password-confirm"].value then
+ if usersettings.value["vm-password"] and usersettings.value["vm-password-confirm"] and usersettings.value["vm-password"].value ~= usersettings.value["vm-password-confirm"].value then
success = false
usersettings.value["vm-password-confirm"].errtxt = "Password does not match"
end