diff --git a/system/typemill/Models/Validation.php b/system/typemill/Models/Validation.php index 2ea11a1..df718fe 100644 --- a/system/typemill/Models/Validation.php +++ b/system/typemill/Models/Validation.php @@ -127,13 +127,15 @@ class Validation Validator::addRule('navigation', function($field, $value, array $params, array $fields) { - $format = '/[@#^*()=\[\]{};:"\\|,.<>\/]/'; - if ( preg_match($format, $value)) +# $format = '/[@#^*()=\[\]{};:"\\|,.<>\/]/'; + $format = '/^(?![ .])[^\0\/\\?%*:|"<>]+(?]+[!?]$/'; + + if ( preg_match($format, $value) === 1) { - return false; + return true; } - return true; - }, 'contains special characters'); + return false; + }, 'contains invalid characters or patterns'); Validator::addRule('noSpecialChars', function($field, $value, array $params, array $fields) { diff --git a/system/typemill/author/js/vue-contentnavi.js b/system/typemill/author/js/vue-contentnavi.js index e32a5d4..ec986e9 100644 --- a/system/typemill/author/js/vue-contentnavi.js +++ b/system/typemill/author/js/vue-contentnavi.js @@ -223,7 +223,8 @@ navigation.component('navilevel',{ load: '?', freeze: false, newItem: '', - format: /[@#*()=\[\]{};:"\\|,.<>\/]/, +/* format: /[@#*()=\[\]{};:"\\|,.<>\/]/, */ + format: /(^\.)|(\.$)|[\/\\?%*:|"<>]/, } }, computed: @@ -400,9 +401,13 @@ navigation.component('navilevel',{ { eventBus.$emit('publisherclear'); - if( this.format.test(this.newItem) || !this.newItem || this.newItem.length > 40) + if( + this.format.test(this.newItem) || + !this.newItem || + this.newItem.length > 60 + ) { - let message = this.$filters.translate('Special Characters are not allowed. Length between 1 and 40.'); + let message = this.$filters.translate('Special characters or invalid patterns are not allowed. Length between 1 and 60.'); eventBus.$emit('publishermessage', message); return; }