From 9665c970afd9fcf51324dfa0a40adddbe1572de1 Mon Sep 17 00:00:00 2001 From: james Date: Thu, 22 Dec 2011 15:35:46 -0500 Subject: [PATCH] CC-3218: Stream-settings: Spaces and other illegal characters should not be allowed in the fields: server, username, password, URL, and mount point - adding an another mask for domain name. Front and backend --- airtime_mvc/application/forms/StreamSettingSubForm.php | 4 ++-- airtime_mvc/public/js/airtime/preferences/streamsetting.js | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/airtime_mvc/application/forms/StreamSettingSubForm.php b/airtime_mvc/application/forms/StreamSettingSubForm.php index 2d69d9c29..bbda6576c 100644 --- a/airtime_mvc/application/forms/StreamSettingSubForm.php +++ b/airtime_mvc/application/forms/StreamSettingSubForm.php @@ -84,12 +84,12 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm{ $host->setLabel("Server") ->setValue(isset($setting[$prefix.'_host'])?$setting[$prefix.'_host']:"") ->setValidators(array( - array('regex', false, array('/^[^ &<>]+$/', 'messages' => 'Invalid character entered')))) + array('regex', false, array('/^[0-9a-zA-Z-_.]+$/', 'messages' => 'Invalid character entered')))) ->setDecorators(array('ViewHelper')); if($disable_all){ $host->setAttrib("disabled", "disabled"); } - $host->setAttrib('alt', 'regular_text'); + $host->setAttrib('alt', 'domain'); $this->addElement($host); $port = new Zend_Form_Element_Text('port'); diff --git a/airtime_mvc/public/js/airtime/preferences/streamsetting.js b/airtime_mvc/public/js/airtime/preferences/streamsetting.js index ff5883efe..a8195bb2d 100644 --- a/airtime_mvc/public/js/airtime/preferences/streamsetting.js +++ b/airtime_mvc/public/js/airtime/preferences/streamsetting.js @@ -176,13 +176,15 @@ $(document).ready(function() { setInterval('checkLiquidsoapStatus()', 1000) $.mask.rules = { '@': /[^ &<>]/, - 'u': /[0-9a-zA-Z-_.:/]/ + 'u': /[0-9a-zA-Z-_.:/]/, + 'd': /[0-9a-zA-Z-_.]/ } // add masking on the fields that don't allow special chars $.mask.masks = $.extend($.mask.masks,{ regular_text:{ mask: '@', type:'repeat', 'maxLength': 256, selectCharsOnFocus: false, autoTab: false, fixedChars : '[(),:/]'}, - url:{ mask: 'u', type:'repeat', 'maxLength': 261, selectCharsOnFocus: false, autoTab: false, fixedChars : '[(),]'} + url:{ mask: 'u', type:'repeat', 'maxLength': 261, selectCharsOnFocus: false, autoTab: false, fixedChars : '[(),]'}, + domain:{ mask: 'd', type:'repeat', 'maxLength': 261, selectCharsOnFocus: false, autoTab: false, fixedChars : '[(),:/]'} }) $('input:text').setMask()