1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-11-22 11:45:59 +01: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

@ -17,6 +17,7 @@
"lib/sjcl/sjcl.js",
"lib/sjcl/cbc.js",
"lib/sjcl/bitArray.js",
"scripts/tld.js",
"models/api/requestModels.js",
"models/api/responseModels.js",
"models/dataModels.js",

View File

@ -21,4 +21,7 @@
})
.factory('syncService', function () {
return chrome.extension.getBackgroundPage().syncService;
})
.factory('tldjs', function () {
return chrome.extension.getBackgroundPage().tldjs;
});

View File

@ -1,2 +1,2 @@
angular
.module('bit.vault', ['ngAnimate', 'toastr']);
.module('bit.vault', ['ngAnimate', 'toastr', 'ngclipboard']);

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;
};
});

View File

@ -18,21 +18,30 @@
<span class="item-label">Name</span>
{{site.name}}
</div>
<div class="list-section-item">
<a class="btn-list" href=""><i class="fa fa-lg fa-share-square-o"></i></a>
<div class="list-section-item" ng-show="site.uri">
<a class="btn-list" href="" ng-click="launchWebsite(site)" ng-show="site.showLaunch">
<i class="fa fa-lg fa-share-square-o"></i>
</a>
<span class="item-label">Website</span>
{{site.uri}}
{{site.website}}
</div>
<div class="list-section-item">
<a class="btn-list" href=""><i class="fa fa-lg fa-clipboard"></i></a>
<div class="list-section-item" ng-show="site.username">
<a class="btn-list" href="" ngclipboard ngclipboard-error="clipboardError(e)"
ngclipboard-success="clipboardSuccess(e, 'Username')" data-clipboard-target="#username">
<i class="fa fa-lg fa-clipboard"></i>
</a>
<span class="item-label">Username</span>
{{site.username}}
<span id="username">{{site.username}}</span>
</div>
<div class="list-section-item">
<a class="btn-list" href=""><i class="fa fa-lg fa-clipboard"></i></a>
<a class="btn-list" href=""><i class="fa fa-lg fa-eye"></i></a>
<div class="list-section-item" ng-show="site.password">
<a class="btn-list" href="" ngclipboard ngclipboard-error="clipboardError(e)"
ngclipboard-success="clipboardSuccess(e, 'Password')" data-clipboard-target="#password">
<i class="fa fa-lg fa-clipboard"></i>
</a>
<a class="btn-list" href="" ng-click="togglePassword()"><i class="fa fa-lg fa-eye"></i></a>
<span class="item-label">Password</span>
{{site.maskedPassword}}
<span ng-show="!showPassword">{{site.maskedPassword}}</span>
<span id="password" ng-show="showPassword">{{site.password}}</span>
</div>
</div>
</div>

View File

@ -12,13 +12,16 @@
<script src="../lib/jquery/jquery.js"></script>
<script src="../lib/bootstrap/js/bootstrap.js"></script>
<script src="scripts/popup.js"></script>
<script src="../lib/clipboard/clipboard.js"></script>
<script src="../lib/angular/angular.js"></script>
<script src="../lib/angular-animate/angular-animate.js"></script>
<script src="../lib/angular-ui-router/angular-ui-router.js"></script>
<script src="../lib/angular-jwt/angular-jwt.js"></script>
<script src="../lib/angular-toastr/angular-toastr.tpls.js"></script>
<script src="../lib/ngclipboard/ngclipboard.js"></script>
<script src="app/app.js"></script>
<script src="app/settings.js"></script>

13
src/scripts/tld.js Normal file

File diff suppressed because one or more lines are too long