summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTed Trask <ttrask01@yahoo.com>2011-05-17 08:19:32 +0000
committerTed Trask <ttrask01@yahoo.com>2011-05-17 08:19:32 +0000
commit02c2e8201e6cdcab0f0f5b38fe08c82cf5977c89 (patch)
tree8f9cf464ae5d44bf5ff575c9fffa5ad6081312d4
parentcbbe919044e82ea8c8f0b4648db007dadd15db82 (diff)
downloadacf-freeswitch-vmail-02c2e8201e6cdcab0f0f5b38fe08c82cf5977c89.tar.bz2
acf-freeswitch-vmail-02c2e8201e6cdcab0f0f5b38fe08c82cf5977c89.tar.xz
Passwords must be at least three digits
-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