Skip to content

Commit 252880f

Browse files
authored
Merge pull request #8181 from ProcessMaker/feature/FOUR-23805
FOUR-23805: Update the text of modal to create a URL and validate the URL
2 parents 5241419 + 83d5596 commit 252880f

File tree

2 files changed

+21
-4
lines changed

2 files changed

+21
-4
lines changed

resources/js/admin/settings/components/ModalWhiteList.vue

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66
>
77
<template #modal-title>
88
<div class="tw-self-stretch tw-text-base tw-font-medium tw-text-[#20242A]">
9-
{{ $t("URL Creation") }}
9+
{{ $t("Configure URL Parents for Embedding") }}
1010
</div>
1111
<div class="tw-self-stretch tw-text-sm tw-text-[#596372]">
12-
{{ $t("Please provide your information to create an account.") }}
12+
{{ $t("Please provide a valid URL (e.g., https://example.com ) to specify the allowed origin(s) permitted to embed ProcessMaker.") }}
1313
</div>
1414
</template>
1515
<div class="tw-block">
@@ -31,16 +31,19 @@
3131
<div class="form-group col-md-12">
3232
<div class="d-flex flex-column">
3333
<label for="url">
34-
{{ $t("Site Name") }}
34+
{{ $t("Url") }}
3535
</label>
3636
<b-form-input
3737
id="url"
3838
v-model="url"
3939
type="text"
4040
required
41-
placeholder="http://www.sample.org/head"
41+
placeholder="https://www.sample.org/head"
4242
:state="stateURL"
4343
/>
44+
<div v-if="urlError" class="text-danger mt-1">
45+
{{ urlError }}
46+
</div>
4447
</div>
4548
</div>
4649
</div>
@@ -68,6 +71,7 @@ export default {
6871
stateURL: null,
6972
groupName: "",
7073
group_id: 3,
74+
urlError: "",
7175
};
7276
},
7377
methods: {
@@ -79,6 +83,11 @@ export default {
7983
clear() {
8084
this.siteName = "";
8185
this.url = "";
86+
this.urlError = "";
87+
},
88+
validateURL(url) {
89+
const pattern = /^(https?:\/\/)?(\*\.)?([a-zA-Z0-9-]+\.)+[a-zA-Z]{2,}(:\d+)?(\/.*)?$/;
90+
return pattern.test(url);
8291
},
8392
addWhiteListURL() {
8493
if (!this.siteName) {
@@ -89,6 +98,12 @@ export default {
8998
this.stateURL = false;
9099
return;
91100
}
101+
// Validate the URL using the regex pattern
102+
if (!this.validateURL(this.url)) {
103+
this.stateURL = false;
104+
this.urlError = __("Please enter a valid URL.");
105+
return;
106+
}
92107
const site = this.siteName.toLocaleLowerCase().trim().replaceAll(" ", "_");
93108
const data = {
94109
key: `white_list.${site}`,

resources/lang/en.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -444,6 +444,7 @@
444444
"Configure Script": "Configure Script",
445445
"Configure Template": "Configure Template",
446446
"Configure the authenticator app": "Configure the authenticator app",
447+
"Configure URL Parents for Embedding": "Configure URL Parents for Embedding",
447448
"Configure": "Configure",
448449
"Confirm and Save": "Confirm and Save",
449450
"Confirm New Password": "Confirm New Password",
@@ -1549,6 +1550,7 @@
15491550
"Please choose the tasks in your inbox that this new rule should apply to. <b>Use the column filters</b> to achieve this.": "Please choose the tasks in your inbox that this new rule should apply to. <b>Use the column filters</b> to achieve this.",
15501551
"Please contact your administrator to get started.": "Please contact your administrator to get started.",
15511552
"Please enter Tab Name": "Please enter Tab Name",
1553+
"Please provide a valid URL (e.g., https://example.com ) to specify the allowed origin(s) permitted to embed ProcessMaker.": "Please provide a valid URL (e.g., https://example.com ) to specify the allowed origin(s) permitted to embed ProcessMaker.",
15521554
"Please log in to continue your work on this page.": "Please log in to continue your work on this page.",
15531555
"Please select a Saved Search": "Please select a Saved Search",
15541556
"Please take a look at it in the 'Rules' section located within your Inbox.": "Please take a look at it in the 'Rules' section located within your Inbox.",

0 commit comments

Comments
 (0)