From 2550bc6552378775e34ee2f9ec39c4991c5d38d7 Mon Sep 17 00:00:00 2001 From: fnuesse Date: Sat, 22 Dec 2018 10:44:06 +0100 Subject: Updated link-detection in detailview and fixed link only redirecting to cloud.com/server/apps/passman/{{link}} in detailview Signed-off-by: fnuesse --- js/app/directives/credentialfield.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'js/app') diff --git a/js/app/directives/credentialfield.js b/js/app/directives/credentialfield.js index 44a6c276..6e0efd17 100644 --- a/js/app/directives/credentialfield.js +++ b/js/app/directives/credentialfield.js @@ -36,7 +36,8 @@ value: '=value', secret: '=secret', inputField: '=useInput', - inputFieldplaceholder: '=inputPlaceholder' + inputFieldplaceholder: '=inputPlaceholder', + isURL: '=isurl' }, restrict: 'A', replace: 'true', @@ -49,11 +50,11 @@ '' + '
' + '
' + - '
' + + '
' + '
' + '
', link: function (scope) { - var expression = /(https?:\/\/(?:www\.|(?!www))[^\s\.]+\.[^\s]{2,}|www\.[^\s]+\.[^\s]{2,})/gi; + var expression = /(https?:\/\/(?:www\.|(?!www))[^\s\.]+\.[^\s]{2,}|www\.[^\s]+\.[^\s]{2,})/gi; var regex = new RegExp(expression); $translate(['toggle.visibility','copy.field', 'copy', 'copied']).then(function (translations) { scope.tggltxt = translations['toggle.visibility']; @@ -67,9 +68,11 @@ } if (regex.test(scope.value)) { scope.isLink = true; - if(scope.value.substr(0,4) !== 'http'){ - scope.value = 'http://'+scope.value; - } + } else if (regex.test('http://'+scope.value) && scope.isURL){ + //This part is added to check if the user did not add http or https to the url and match it nonetheless + scope.isLink = true; + } else { + scope.isLink = false; } } }); -- cgit v1.2.3 From b5f7baab12493fd81629eadcdbb8e6ff88e97182 Mon Sep 17 00:00:00 2001 From: newhinton Date: Sat, 29 Dec 2018 17:28:36 +0100 Subject: Fixed Linkdetection --- js/app/directives/credentialfield.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'js/app') diff --git a/js/app/directives/credentialfield.js b/js/app/directives/credentialfield.js index 6e0efd17..eb82dc06 100644 --- a/js/app/directives/credentialfield.js +++ b/js/app/directives/credentialfield.js @@ -51,10 +51,10 @@ '
' + '
' + '
' + - '
' + + '
' + '
', link: function (scope) { - var expression = /(https?:\/\/(?:www\.|(?!www))[^\s\.]+\.[^\s]{2,}|www\.[^\s]+\.[^\s]{2,})/gi; + var expression = /(https?:\/\/(?:www\.|(?!www))[^\s\.]+\.[^\s]{2,}|www\.[^\s]+\.[^\s]{2,})/gi; var regex = new RegExp(expression); $translate(['toggle.visibility','copy.field', 'copy', 'copied']).then(function (translations) { scope.tggltxt = translations['toggle.visibility']; @@ -68,11 +68,15 @@ } if (regex.test(scope.value)) { scope.isLink = true; + if(scope.value.substr(0,4) !== 'http'){ + var val = scope.value; + scope.value =val.substr(val.indexOf("://")+3,val.length); + } } else if (regex.test('http://'+scope.value) && scope.isURL){ - //This part is added to check if the user did not add http or https to the url and match it nonetheless - scope.isLink = true; + //This part is added to check if the user did not add http or https to the url and match it nonetheless + scope.isLink = true; } else { - scope.isLink = false; + scope.isLink = false; } } }); -- cgit v1.2.3 From ee335aab8780b94b4a0d965129e7e87efca435ab Mon Sep 17 00:00:00 2001 From: newhinton Date: Sat, 29 Dec 2018 17:38:39 +0100 Subject: fixed wrong url-creation which appended multiple protocols --- js/app/directives/credentialfield.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'js/app') diff --git a/js/app/directives/credentialfield.js b/js/app/directives/credentialfield.js index eb82dc06..feb54fd0 100644 --- a/js/app/directives/credentialfield.js +++ b/js/app/directives/credentialfield.js @@ -68,16 +68,16 @@ } if (regex.test(scope.value)) { scope.isLink = true; - if(scope.value.substr(0,4) !== 'http'){ - var val = scope.value; - scope.value =val.substr(val.indexOf("://")+3,val.length); - } } else if (regex.test('http://'+scope.value) && scope.isURL){ //This part is added to check if the user did not add http or https to the url and match it nonetheless scope.isLink = true; } else { scope.isLink = false; } + if(scope.value.substr(0,4) !== 'http'){ + var val = scope.value; + scope.value =val.substr(val.indexOf("://")+3,val.length); + } } }); if (!scope.toggle) { -- cgit v1.2.3 From b5d8ba8e46a6d3b71b671120d28309651c5b34bc Mon Sep 17 00:00:00 2001 From: fnuesse Date: Sun, 30 Dec 2018 13:16:49 +0100 Subject: Fixed wrong url-building in sidebar and updated codestyle Signed-off-by: fnuesse --- js/app/directives/credentialfield.js | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) (limited to 'js/app') diff --git a/js/app/directives/credentialfield.js b/js/app/directives/credentialfield.js index feb54fd0..1812c64b 100644 --- a/js/app/directives/credentialfield.js +++ b/js/app/directives/credentialfield.js @@ -50,11 +50,12 @@ '' + '
' + '
' + - '
' + - '
' + + '
' + + '
' + + '
' + '
', link: function (scope) { - var expression = /(https?:\/\/(?:www\.|(?!www))[^\s\.]+\.[^\s]{2,}|www\.[^\s]+\.[^\s]{2,})/gi; + var expression = /(https?:\/\/(?:www\.|(?!www))[^\s\.]+\.[^\s]{2,}|www\.[^\s]+\.[^\s]{2,})/gi; var regex = new RegExp(expression); $translate(['toggle.visibility','copy.field', 'copy', 'copied']).then(function (translations) { scope.tggltxt = translations['toggle.visibility']; @@ -68,16 +69,13 @@ } if (regex.test(scope.value)) { scope.isLink = true; - } else if (regex.test('http://'+scope.value) && scope.isURL){ - //This part is added to check if the user did not add http or https to the url and match it nonetheless - scope.isLink = true; } else { - scope.isLink = false; - } - if(scope.value.substr(0,4) !== 'http'){ - var val = scope.value; - scope.value =val.substr(val.indexOf("://")+3,val.length); + scope.isLink = false; + if(regex.test('https://'+scope.value)){ + scope.isPartialLink = true; + } } + } }); if (!scope.toggle) { -- cgit v1.2.3 From 216c8ff8b55aa6ec2bddcfb82efcb8acd8afa66b Mon Sep 17 00:00:00 2001 From: fnuesse Date: Sun, 30 Dec 2018 13:19:58 +0100 Subject: Removed unused variable Signed-off-by: fnuesse --- js/app/directives/credentialfield.js | 1 - 1 file changed, 1 deletion(-) (limited to 'js/app') diff --git a/js/app/directives/credentialfield.js b/js/app/directives/credentialfield.js index 1812c64b..3b0aabf3 100644 --- a/js/app/directives/credentialfield.js +++ b/js/app/directives/credentialfield.js @@ -37,7 +37,6 @@ secret: '=secret', inputField: '=useInput', inputFieldplaceholder: '=inputPlaceholder', - isURL: '=isurl' }, restrict: 'A', replace: 'true', -- cgit v1.2.3 From 78fcc587758df069dfe7e3c10196567588c04a67 Mon Sep 17 00:00:00 2001 From: fnuesse Date: Fri, 11 Jan 2019 23:29:34 +0100 Subject: only show url-button on url-field Signed-off-by: fnuesse --- js/app/directives/credentialfield.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'js/app') diff --git a/js/app/directives/credentialfield.js b/js/app/directives/credentialfield.js index 3b0aabf3..d59bbf9b 100644 --- a/js/app/directives/credentialfield.js +++ b/js/app/directives/credentialfield.js @@ -37,6 +37,7 @@ secret: '=secret', inputField: '=useInput', inputFieldplaceholder: '=inputPlaceholder', + isURLFIELD: '=url', }, restrict: 'A', replace: 'true', @@ -49,8 +50,8 @@ '' + '
' + '
' + - '
' + - '
' + + '
' + + '
' + '
' + '
', link: function (scope) { -- cgit v1.2.3 From e4437bc244ffe8bae66db9d18b4e9a2ffbb88812 Mon Sep 17 00:00:00 2001 From: fnuesse Date: Fri, 11 Jan 2019 23:34:39 +0100 Subject: fixed wrong variablename Signed-off-by: fnuesse --- js/app/directives/credentialfield.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'js/app') diff --git a/js/app/directives/credentialfield.js b/js/app/directives/credentialfield.js index d59bbf9b..c0a9490e 100644 --- a/js/app/directives/credentialfield.js +++ b/js/app/directives/credentialfield.js @@ -50,8 +50,8 @@ '' + '
' + '
' + - '
' + - '
' + + '
' + + '
' + '
' + '
', link: function (scope) { -- cgit v1.2.3