diff --git a/public/js/components/DashboardWidget/Url.js b/public/js/components/DashboardWidget/Url.js index b87ef4235..8dabf7b4c 100644 --- a/public/js/components/DashboardWidget/Url.js +++ b/public/js/components/DashboardWidget/Url.js @@ -5,6 +5,7 @@ export default { data: () => ({ title_input: "", url_input: "", + invalidURL: false, }), mixins: [AbstractWidget], computed: { @@ -35,6 +36,15 @@ export default { if ((await this.$fhcAlert.confirmDelete()) === false) return; }, addLink() { + // reset is-invalid css on url input field + this.invalidURL = false; + + if(!URL.canParse(this.url_input)) + { + this.$fhcAlert.alertError(this.$p.t("bookmark", "invalidUrl")); + this.invalidURL = true; + return; + } this.$fhcApi.factory.bookmark .insert({ tag: this.config.tag, @@ -83,7 +93,10 @@ export default {
{{$p.t('bookmark','newLink')}}

- + +
+ {{$p.t("bookmark", "invalidUrl")}}. +
diff --git a/system/phrasesupdate.php b/system/phrasesupdate.php index e5275d513..22f7491df 100644 --- a/system/phrasesupdate.php +++ b/system/phrasesupdate.php @@ -31484,6 +31484,26 @@ array( ) ) ), + array( + 'app' => 'core', + 'category' => 'bookmark', + 'phrase' => 'invalidUrl', + 'insertvon' => 'system', + 'phrases' => array( + array( + 'sprache' => 'German', + 'text' => 'Ungültiger Link', + 'description' => '', + 'insertvon' => 'system' + ), + array( + 'sprache' => 'English', + 'text' => 'Invalid link', + 'description' => '', + 'insertvon' => 'system' + ) + ) + ), array( 'app' => 'core', 'category' => 'global',