From 48a5ca29e7b8cbeb053eaf1dee27fd9ed24747d3 Mon Sep 17 00:00:00 2001 From: Caleb Cox Date: Tue, 22 Oct 2024 15:51:29 -0500 Subject: [PATCH 1/3] Prevent conference names from containing special characters --- app/scripts/controllers/eventDashboard.js | 4 --- app/scripts/controllers/eventDetails.js | 5 +++ app/views/modals/createEvent.html | 41 ++++++++++++++++------ test/spec/controllers/eventDetails.spec.js | 16 +++++++++ 4 files changed, 52 insertions(+), 14 deletions(-) diff --git a/app/scripts/controllers/eventDashboard.js b/app/scripts/controllers/eventDashboard.js index a8fb55df2..877228fbf 100644 --- a/app/scripts/controllers/eventDashboard.js +++ b/app/scripts/controllers/eventDashboard.js @@ -41,10 +41,6 @@ angular templateUrl: createEventModalTemplate, }) .result.then(function (conferenceName) { - if (!conferenceName) { - return; - } - ConfCache.create(conferenceName).then(function (conference) { $location.path('/eventDetails/' + conference.id); }); diff --git a/app/scripts/controllers/eventDetails.js b/app/scripts/controllers/eventDetails.js index d8068a917..0980601e6 100644 --- a/app/scripts/controllers/eventDetails.js +++ b/app/scripts/controllers/eventDetails.js @@ -263,6 +263,11 @@ angular if (_.isEmpty($scope.conference.name)) { validationErrors.push('Please enter an event name.'); } + if (/[&"]/.test($scope.conference.name)) { + validationErrors.push( + 'Please remove double quotes (") and ampersands (&) from the event name.', + ); + } if (_.isEmpty($scope.conference.abbreviation)) { validationErrors.push('Please enter an event abbreviation.'); diff --git a/app/views/modals/createEvent.html b/app/views/modals/createEvent.html index ae3678f00..2c343d7c6 100644 --- a/app/views/modals/createEvent.html +++ b/app/views/modals/createEvent.html @@ -2,25 +2,46 @@

Create Event

-