From 6ac0fb1e097f7deb9ad8123c75451b15f1ce5318 Mon Sep 17 00:00:00 2001 From: Spellauge Date: Mon, 19 Oct 2015 09:32:54 +0200 Subject: [PATCH] validateRoomName --- lang/main-de.json | 4 +++- lang/main.json | 4 +++- modules/UI/welcome_page/WelcomePage.js | 15 +++++++++++++-- 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/lang/main-de.json b/lang/main-de.json index 129c45376..3e800e744 100644 --- a/lang/main-de.json +++ b/lang/main-de.json @@ -126,6 +126,8 @@ "mutedTitle": "Stummschaltung aktiv." }, "dialog": { + "illCharInRoomNameMessage": "Ungültiges Zeichen im Raumnamen", + "roomNameHint": "Ein gültiger Raumname besteht aus Buchstaben, Ziffern, + und = Zeichen.", "kickMessage": "Oh! Sie wurden aus der Konferenz ausgeschlossen.", "popupError": "Ihr Browser blockiert Popup-Fenster von dieser Webseite. Bitte erlauben Sie dieser Seite Popups in den Sicherheitseinstellungen Ihres Browsers und versuchen Sie es erneut.", "passwordError": "Diese Konferenz ist mit einem Paswort geschützt. Nur der Besitzer der Konferenz kann ein Passwort vergeben.", @@ -241,4 +243,4 @@ "pending": "Die Aufzeichnung wird gestartet sobald ein weiterer Teilnehmer beitritt", "on": "Aufzeichnung wurde gestartet" } -} \ No newline at end of file +} diff --git a/lang/main.json b/lang/main.json index 6b5ff4960..94db5be83 100644 --- a/lang/main.json +++ b/lang/main.json @@ -130,7 +130,9 @@ "mutedTitle": "You're muted!" }, "dialog": { - "kickMessage": "Ouch! You have been kicked out of the meet!", + "illCharInRoomNameMessage": "Illegal Character in Room Name", + "roomNameHint": "A valid room name may contain only letters, digits, + signs and = -characters.", + "kickMessage": "Ouch ! You have been kicked out of the meet!", "popupError": "Your browser is blocking popup windows from this site. Please enable popups in your browser's security settings and try again.", "passwordError": "This conversation is currently protected by a password. Only the owner of the conference can set a password.", "passwordError2": "This conversation isn't currently protected by a password. Only the owner of the conference can set a password.", diff --git a/modules/UI/welcome_page/WelcomePage.js b/modules/UI/welcome_page/WelcomePage.js index 3a7b9692d..da2297a0c 100644 --- a/modules/UI/welcome_page/WelcomePage.js +++ b/modules/UI/welcome_page/WelcomePage.js @@ -2,14 +2,25 @@ var animateTimeout, updateTimeout; var RoomNameGenerator = require("./RoomnameGenerator"); +var messageHandler = require("../util/MessageHandler"); function enter_room() { var val = $("#enter_room_field").val(); if(!val) { - val = $("#enter_room_field").attr("room_name"); + val = $("#enter_room_field").attr("room_name"); } if (val) { + // also ÄÖÜäöüß - requiers further changes (nginx - sites-enabled + // (locatin .. rewrite), other js-modules + // var validRoomNamePattern = + // /^[a-zA-Z0-9=\?\+\u00c4\u00e4\u00d6\u00f6\u00dc\u00fc\u00df\ ]+$/; + var validRoomNamePattern = /^[a-zA-Z0-9=\?\+]+$/; + if (val.match(validRoomNamePattern) !== null) { window.location.pathname = "/" + val; + } else { + messageHandler.openMessageDialog ( + "dialog.illCharInRoomNameMessage", "dialog.roomNameHint"); + } } } @@ -93,4 +104,4 @@ function setupWelcomePage() { } -module.exports = setupWelcomePage; \ No newline at end of file +module.exports = setupWelcomePage;