From 2550bc6552378775e34ee2f9ec39c4991c5d38d7 Mon Sep 17 00:00:00 2001 From: fnuesse Date: Sat, 22 Dec 2018 10:44:06 +0100 Subject: [PATCH 1/7] 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 +++++++++------ templates/views/partials/credential_template.html | 3 +-- 2 files changed, 10 insertions(+), 8 deletions(-) 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; } } }); diff --git a/templates/views/partials/credential_template.html b/templates/views/partials/credential_template.html index 683762d3..4defeb17 100644 --- a/templates/views/partials/credential_template.html +++ b/templates/views/partials/credential_template.html @@ -36,8 +36,7 @@
{{ 'url' | translate}}
-
+
From b5f7baab12493fd81629eadcdbb8e6ff88e97182 Mon Sep 17 00:00:00 2001 From: newhinton Date: Sat, 29 Dec 2018 17:28:36 +0100 Subject: [PATCH 2/7] Fixed Linkdetection --- js/app/directives/credentialfield.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) 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; } } }); From ee335aab8780b94b4a0d965129e7e87efca435ab Mon Sep 17 00:00:00 2001 From: newhinton Date: Sat, 29 Dec 2018 17:38:39 +0100 Subject: [PATCH 3/7] fixed wrong url-creation which appended multiple protocols --- js/app/directives/credentialfield.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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) { From b5d8ba8e46a6d3b71b671120d28309651c5b34bc Mon Sep 17 00:00:00 2001 From: fnuesse Date: Sun, 30 Dec 2018 13:16:49 +0100 Subject: [PATCH 4/7] Fixed wrong url-building in sidebar and updated codestyle Signed-off-by: fnuesse --- js/app/directives/credentialfield.js | 20 ++++++------ .../views/partials/credential_template.html | 32 +++++++++++-------- 2 files changed, 28 insertions(+), 24 deletions(-) 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) { diff --git a/templates/views/partials/credential_template.html b/templates/views/partials/credential_template.html index 4defeb17..5f7c4ac5 100644 --- a/templates/views/partials/credential_template.html +++ b/templates/views/partials/credential_template.html @@ -1,47 +1,53 @@
{{ 'label' | translate }}
-
+
+ +
{{ 'account' | translate }}
-
+
+ +
{{ 'password' | translate }}
- - - +
{{'otp' | translate}}
-
+
+ +
{{'email' | translate}}
-
+
+ +
{{ 'url' | translate}}
-
+
+ +
{{'notes' | translate}}
-
+
+ +
From 216c8ff8b55aa6ec2bddcfb82efcb8acd8afa66b Mon Sep 17 00:00:00 2001 From: fnuesse Date: Sun, 30 Dec 2018 13:19:58 +0100 Subject: [PATCH 5/7] Removed unused variable Signed-off-by: fnuesse --- js/app/directives/credentialfield.js | 1 - templates/views/partials/credential_template.html | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) 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', diff --git a/templates/views/partials/credential_template.html b/templates/views/partials/credential_template.html index 5f7c4ac5..3c381f4a 100644 --- a/templates/views/partials/credential_template.html +++ b/templates/views/partials/credential_template.html @@ -39,7 +39,7 @@
{{ 'url' | translate}}
- +
From 78fcc587758df069dfe7e3c10196567588c04a67 Mon Sep 17 00:00:00 2001 From: fnuesse Date: Fri, 11 Jan 2019 23:29:34 +0100 Subject: [PATCH 6/7] only show url-button on url-field Signed-off-by: fnuesse --- js/app/directives/credentialfield.js | 5 +++-- templates/views/partials/credential_template.html | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) 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) { diff --git a/templates/views/partials/credential_template.html b/templates/views/partials/credential_template.html index 3c381f4a..289e64a8 100644 --- a/templates/views/partials/credential_template.html +++ b/templates/views/partials/credential_template.html @@ -39,7 +39,7 @@
{{ 'url' | translate}}
- +
From e4437bc244ffe8bae66db9d18b4e9a2ffbb88812 Mon Sep 17 00:00:00 2001 From: fnuesse Date: Fri, 11 Jan 2019 23:34:39 +0100 Subject: [PATCH 7/7] fixed wrong variablename Signed-off-by: fnuesse --- js/app/directives/credentialfield.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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) {