Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/passman.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/js/app
diff options
context:
space:
mode:
authornewhinton <newhinton@users.noreply.github.com>2018-12-29 19:28:36 +0300
committerGitHub <noreply@github.com>2018-12-29 19:28:36 +0300
commitb5f7baab12493fd81629eadcdbb8e6ff88e97182 (patch)
tree23f87060fcb6e26b58c1b13ef60823b90f24e705 /js/app
parent2550bc6552378775e34ee2f9ec39c4991c5d38d7 (diff)
Fixed Linkdetection
Diffstat (limited to 'js/app')
-rw-r--r--js/app/directives/credentialfield.js14
1 files 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 @@
'<div class="tools">' +
'<div class="cell" ng-if="toggle" tooltip="tggltxt" ng-click="toggleVisibility()"><i class="fa" ng-class="{\'fa-eye\': !valueVisible, \'fa-eye-slash\': valueVisible }"></i></div>' +
'<div class="cell" ng-if="isLink"><a ng-href="//{{value}}" target="_blank" rel="nofollow noopener noreferrer"><i tooltip="\'Open in new window\'" class="link fa fa-external-link"></i></a></div>' +
- '<div class="cell" ngclipboard-success="onSuccess(e);" ngclipboard-error="onError(e);" ngclipboard data-clipboard-text="{{value}}"><i tooltip="copy_msg" class="fa fa-files-o"></i></div>' +
+ '<div class="cell" ngclipboard-success="onSuccess(e);" ngclipboard-error="onError(e);" ngclipboard data-clipboard-text="{{value}}"><i tooltip="copy_msg" class="fa fa-files-o"></i></div>' +
'</div></span>',
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;
}
}
});