1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-14 15:23:33 +00:00

Added tld.js for domain parsing. Added view site clipboard functions and password visibility toggle.

This commit is contained in:
Kyle Spearrin
2016-09-12 22:37:59 -04:00
parent 5f39939d65
commit 8762d246cf
7 changed files with 75 additions and 12 deletions

View File

@@ -1,7 +1,7 @@
angular
.module('bit.vault')
.controller('vaultViewSiteController', function ($scope, $state, $stateParams, siteService, cipherService) {
.controller('vaultViewSiteController', function ($scope, $state, $stateParams, siteService, cipherService, tldjs, toastr) {
var returnScrollY = $stateParams.returnScrollY;
$scope.site = null;
@@ -17,10 +17,44 @@
$scope.site.maskedPassword = maskedPassword;
}
if (model.uri) {
$scope.site.showLaunch = model.uri.startsWith('http://') || model.uri.startsWith('https://');
var domain = tldjs.getDomain(model.uri);
if (domain) {
$scope.site.website = domain;
}
else {
$scope.site.website = model.uri;
}
}
else {
$scope.site.showLaunch = false;
}
});
});
$scope.close = function () {
$state.go('tabs.vault', { animation: 'out-slide-down', scrollY: returnScrollY || 0 });
};
$scope.launchWebsite = function (site) {
if (site.showLaunch) {
chrome.tabs.create({ url: site.uri });
}
};
$scope.clipboardError = function (e, password) {
toastr.info('Your web browser does not support easy clipboard copying. Copy it manually instead.');
};
$scope.clipboardSuccess = function (e, type) {
e.clearSelection();
toastr.info(type + ' copied!');
};
$scope.showPassword = false;
$scope.togglePassword = function () {
$scope.showPassword = !$scope.showPassword;
};
});