From fa0af3684d8937176084c29141d10bcbc7b0fb04 Mon Sep 17 00:00:00 2001 From: Daniel Lando Date: Fri, 3 Apr 2020 14:06:16 +0200 Subject: [PATCH] fix: Validation of node names and location to match hass requirements #344 --- src/components/ControlPanel.vue | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/components/ControlPanel.vue b/src/components/ControlPanel.vue index f492d5daee2..abf382d98e6 100644 --- a/src/components/ControlPanel.vue +++ b/src/components/ControlPanel.vue @@ -513,13 +513,17 @@ export default { val || this.closeDialog() }, newName (val) { - this.nameError = /["+*\s]+/g.test(val) - ? 'Remove " + * and blank space characters' + var match = val.match(/[a-zA-Z0-9_-]+/g) + + this.nameError = match[0] !== val + ? 'Only a-zA-Z0-9_- chars are allowed' : null }, newLoc (val) { - this.locError = /["+*\s]+/g.test(val) - ? 'Remove " + * and blank space characters' + var match = val.match(/[a-zA-Z0-9_-]+/g) + + this.locError = match[0] !== val + ? 'Only a-zA-Z0-9_- chars are allowed' : null }, selectedNode () {