From e7504986966a1859db6316c3fe6c27f54b7ddbbb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Thu, 27 Nov 2014 14:22:55 +0100 Subject: [PATCH] Templating: added validation for allowed characters in variable names, Closes #1106 --- src/app/controllers/templateEditorCtrl.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/app/controllers/templateEditorCtrl.js b/src/app/controllers/templateEditorCtrl.js index 5e99208a1d1..51b5d7c9e38 100644 --- a/src/app/controllers/templateEditorCtrl.js +++ b/src/app/controllers/templateEditorCtrl.js @@ -45,6 +45,11 @@ function (angular, _) { return false; } + if (!$scope.current.name.match(/^\w+$/)) { + $scope.appEvent('alert-warning', ['Validation', 'Only word and digit characters are allowed in variable names']); + return false; + } + var sameName = _.findWhere($scope.variables, { name: $scope.current.name }); if (sameName && sameName !== $scope.current) { $scope.appEvent('alert-warning', ['Validation', 'Variable with the same name already exists']);