Skip to content

Commit

Permalink
LPD-19992 Validate id and name fields according to spec
Browse files Browse the repository at this point in the history
  • Loading branch information
antonio-ortega committed Mar 15, 2024
1 parent 38f8da2 commit f10d351
Show file tree
Hide file tree
Showing 17 changed files with 73 additions and 16 deletions.
2 changes: 1 addition & 1 deletion ckeditor-dev
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
From 677ae5062e15f2ce4339fae4cce5eca7ccb0dfb9 Mon Sep 17 00:00:00 2001
From 7b7516ff754511d56ec16f6f581bea2f454361a0 Mon Sep 17 00:00:00 2001
From: Julien Castelain <julien.castelain@liferay.com>
Date: Tue, 14 May 2019 10:47:25 +0200
Subject: [PATCH] LPS-89596 Cannot Drag Image from top content line in IE11
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
From 2fb3f3791a9e82255a3917e7dacd32051a8f1deb Mon Sep 17 00:00:00 2001
From 1b944d8482400fb72b7c4d9376fa09a2f74c6674 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Roland=20P=C3=A1kai?= <roland.pakai@liferay.com>
Date: Tue, 21 May 2019 09:38:15 +0200
Subject: [PATCH] LPS-95472 Tabs in popups not appears correctly in maximized
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
From 9205e96f4ce990decc4d5b93286d3332accbf31f Mon Sep 17 00:00:00 2001
From b957673ddb8ca00bc14c5e31d780a6cf6907e140 Mon Sep 17 00:00:00 2001
From: Julien Castelain <julien.castelain@liferay.com>
Date: Wed, 25 Mar 2020 12:58:15 +0100
Subject: [PATCH] LPS-85326 Remove check for Webkit browsers
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
From 73e98738102ed6868d34da2ede641f95ed81d15b Mon Sep 17 00:00:00 2001
From 24892e5fbcc4ae9d8f173b58ceb2d5b5e9aca5e9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Roland=20P=C3=A1kai?= <roland.pakai@liferay.com>
Date: Tue, 14 Apr 2020 10:15:56 +0200
Subject: [PATCH] LPP-36989 Remove obsolete summary field from table elements
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
From ecb9ac9855c2934b0ad158340f5a2524f224e856 Mon Sep 17 00:00:00 2001
From f7b594db84d5c4973f863ec22be5bd5db0d533d2 Mon Sep 17 00:00:00 2001
From: Julien Castelain <julien.castelain@liferay.com>
Date: Tue, 7 Jul 2020 09:47:27 +0200
Subject: [PATCH] LPS-112982 Add additional resource URL parameters
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
From 67fc472af1861be4049272c33015138368b2d951 Mon Sep 17 00:00:00 2001
From f40579a8dcc5dabc71182ccb201714f0be224850 Mon Sep 17 00:00:00 2001
From: Carlos Lancha <carlos.lancha@liferay.com>
Date: Thu, 6 Aug 2020 14:42:21 +0200
Subject: [PATCH] LPS-118624 Don't pass languageId to css files requests
Expand Down
2 changes: 1 addition & 1 deletion patches/0007-LPS-124728-Avoid-breaking-IE11.patch
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
From 28d5de7bb90438c8825dac721d93a25730511a98 Mon Sep 17 00:00:00 2001
From 5317f0c2f16cdc737fcabda760947351a34715a4 Mon Sep 17 00:00:00 2001
From: Julien Castelain <julien.castelain@liferay.com>
Date: Mon, 21 Dec 2020 09:12:53 +0100
Subject: [PATCH] LPS-124728 Avoid breaking IE11
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
From 07e1d151f387e0eb33b277b8d5db1731d932be24 Mon Sep 17 00:00:00 2001
From 29c99cc1240ed9a91769b43b5967a1f6c0ca7669 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Roland=20P=C3=A1kai?= <roland.pakai@liferay.com>
Date: Fri, 8 Jan 2021 10:58:23 +0100
Subject: [PATCH] LPS-125559 Fix width for the following fields Cell spacing,
Expand Down
2 changes: 1 addition & 1 deletion patches/0009-LPS-131699-Add-null-check.patch
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
From 3f6c78ed9d6ff409d0c738ec1e211e038454a0e7 Mon Sep 17 00:00:00 2001
From 13fa521d777e31fd9f0a06d24458c7cf6c7eb6ad Mon Sep 17 00:00:00 2001
From: IstvanD <istvan.dezsi@liferay.com>
Date: Wed, 19 May 2021 17:43:17 +0200
Subject: [PATCH] LPS-131699 Add null check
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
From 10216fb46ecdaed9c941a278fbea3ab080741684 Mon Sep 17 00:00:00 2001
From ada4353c0a04b9d6258275f2167d9d84db7a9182 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marko=20=C4=8Ciko=C5=A1?= <marko.cikos@liferay.com>
Date: Mon, 9 Aug 2021 18:04:44 +0200
Subject: [PATCH] LPS-136119 Set `id` on first render, instead of changing it
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
From 5eb566996d9d967f397e489e960f2239fd085103 Mon Sep 17 00:00:00 2001
From 098526175167f0fb4ed0d06794be200a030e4a9c Mon Sep 17 00:00:00 2001
From: Norbert Nemeth <norbert.nemeth@liferay.com>
Date: Tue, 17 Aug 2021 11:20:58 +0200
Subject: [PATCH] LPS-136998 Avoid breaking the UI in firefox
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
From 9b5886854dc27f912cc8a97746c69bd7568c600d Mon Sep 17 00:00:00 2001
From 7f540f1106828434a5bc489878bd8dd7fd27c35f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marko=20=C4=8Ciko=C5=A1?= <marko.cikos@liferay.com>
Date: Mon, 16 Aug 2021 18:36:20 +0200
Subject: [PATCH] LPS-137425 Don't check selection on focus
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
From 803da67e1fb33c2dda80e4cf4e9e5cae5b588cfd Mon Sep 17 00:00:00 2001
From f507e3bbbd6e75df0df9eed3d0c81d28b7000638 Mon Sep 17 00:00:00 2001
From: Minhchau <minhchau.dang@liferay.com>
Date: Tue, 28 Sep 2021 11:18:40 -0700
Subject: [PATCH] LPS-139565 When upgrading from 6.2 to 7.1, image width/height
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
From 3bbd5875ca90cb312ab635c7d35e7eed094d0be8 Mon Sep 17 00:00:00 2001
From 584c98cffd52801c85aec685c17df00202b16005 Mon Sep 17 00:00:00 2001
From: Diego Nascimento <diego.nascimento@liferay.com>
Date: Mon, 18 Oct 2021 17:45:43 -0300
Subject: [PATCH] LPS-137763 If contentsElement is defined, use it as a
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
From d7a2cf65337479f2888235add5ffa1817bb60b47 Mon Sep 17 00:00:00 2001
From a8cb71cdfc1ba591b0bfb135c48235e0f47e45d7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marko=20=C4=8Ciko=C5=A1?= <marko.cikos@liferay.com>
Date: Fri, 21 Oct 2022 15:28:58 +0200
Subject: [PATCH] LPS-166086 Make dialog close button accessible with keyboard
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
From 02cad04a4ec12037805dbfbda98707893ef6216f Mon Sep 17 00:00:00 2001
From: Antonio Ortega <60252917@liferay.com>
Date: Fri, 15 Mar 2024 11:36:44 +0100
Subject: [PATCH] LPD-19992 Validate id and name fields according to spec

---
plugins/link/dialogs/link.js | 30 +++++++++++++++++++++++++++++-
1 file changed, 29 insertions(+), 1 deletion(-)

diff --git a/plugins/link/dialogs/link.js b/plugins/link/dialogs/link.js
index 46e452e741..39932fd2d9 100755
--- a/plugins/link/dialogs/link.js
+++ b/plugins/link/dialogs/link.js
@@ -1010,7 +1010,18 @@

this.setupContent( data );
},
- onOk: function() {
+ onOk: function(event) {
+ var idValue = this.getValueOf('advanced', 'advId');
+ var nameValue = this.getValueOf('advanced', 'advName');
+
+ if (
+ !validateField('id', idValue) ||
+ !validateField('name', nameValue)
+ ) {
+ event.data.hide = false;
+ return;
+ }
+
var data = {};

// Collect data from fields.
@@ -1046,6 +1057,23 @@
};
} );

+ function validateField(fieldName, fieldValue) {
+ var regEx = /^[A-Za-z]+[\w\-:.]*$/;
+
+ if (fieldValue && !regEx.test(fieldValue)) {
+ alert(
+ Liferay.Util.sub(
+ Liferay.Language.get('there-was-an-error-when-loading-the-x-field'),
+ fieldName
+ )
+ );
+
+ return false;
+ }
+
+ return true;
+ }
+
function validateTelNumber() {
var dialog = this.getDialog(),
editor = dialog._.editor,

0 comments on commit f10d351

Please sign in to comment.