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
This commit is contained in:
james 2011-12-22 15:35:46 -05:00
parent 30b192a809
commit 9665c970af
2 changed files with 6 additions and 4 deletions

View file

@ -84,12 +84,12 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm{
$host->setLabel("Server") $host->setLabel("Server")
->setValue(isset($setting[$prefix.'_host'])?$setting[$prefix.'_host']:"") ->setValue(isset($setting[$prefix.'_host'])?$setting[$prefix.'_host']:"")
->setValidators(array( ->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')); ->setDecorators(array('ViewHelper'));
if($disable_all){ if($disable_all){
$host->setAttrib("disabled", "disabled"); $host->setAttrib("disabled", "disabled");
} }
$host->setAttrib('alt', 'regular_text'); $host->setAttrib('alt', 'domain');
$this->addElement($host); $this->addElement($host);
$port = new Zend_Form_Element_Text('port'); $port = new Zend_Form_Element_Text('port');

View file

@ -176,13 +176,15 @@ $(document).ready(function() {
setInterval('checkLiquidsoapStatus()', 1000) setInterval('checkLiquidsoapStatus()', 1000)
$.mask.rules = { $.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 // add masking on the fields that don't allow special chars
$.mask.masks = $.extend($.mask.masks,{ $.mask.masks = $.extend($.mask.masks,{
regular_text:{ mask: '@', type:'repeat', 'maxLength': 256, selectCharsOnFocus: false, autoTab: false, fixedChars : '[(),:/]'}, 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() $('input:text').setMask()