1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-12-20 16:07:45 +01:00

back everywhere, a few password history touch-ups

This commit is contained in:
Kyle Spearrin 2017-10-17 17:09:48 -04:00
parent f1262147a3
commit 5b6158c0b7
16 changed files with 62 additions and 69 deletions

View File

@ -946,11 +946,8 @@
"typeIdentity": { "typeIdentity": {
"message": "Identity" "message": "Identity"
}, },
"viewPasswordHistory": { "passwordHistory": {
"message": "View Password History" "message": "Password History"
},
"generatePasswordHistory": {
"message": "Generated Passwords History"
}, },
"back": { "back": {
"message": "Back" "message": "Back"

View File

@ -1,7 +1,7 @@
<form name="theForm" ng-submit="submit(model)" bit-form="submitPromise"> <form name="theForm" ng-submit="submit(model)" bit-form="submitPromise">
<div class="header"> <div class="header">
<div class="left"> <div class="left">
<a ui-sref="login({animation: 'out-slide-right'})"><i class="fa fa-chevron-left"></i> {{i18n.login}}</a> <a ui-sref="login({animation: 'out-slide-right'})"><i class="fa fa-chevron-left"></i> {{i18n.back}}</a>
</div> </div>
<div class="right"> <div class="right">
<button type="submit" class="btn btn-link" ng-show="!theForm.$loading">{{i18n.submit}}</button> <button type="submit" class="btn btn-link" ng-show="!theForm.$loading">{{i18n.submit}}</button>

View File

@ -2,7 +2,7 @@
ng-if="providerType === constantsProvider.authenticator || providerType === constantsProvider.email"> ng-if="providerType === constantsProvider.authenticator || providerType === constantsProvider.email">
<div class="header"> <div class="header">
<div class="left"> <div class="left">
<a href="#" ng-click="back()"><i class="fa fa-chevron-left"></i> {{i18n.login}}</a> <a href="#" ng-click="back()"><i class="fa fa-chevron-left"></i> {{i18n.back}}</a>
</div> </div>
<div class="right"> <div class="right">
<button type="submit" class="btn btn-link" ng-show="!theForm.$loading">{{i18n.continue}}</button> <button type="submit" class="btn btn-link" ng-show="!theForm.$loading">{{i18n.continue}}</button>
@ -47,7 +47,7 @@
<form name="theForm" bit-form="loginPromise" ng-if="providerType === constantsProvider.duo" autocomplete="off"> <form name="theForm" bit-form="loginPromise" ng-if="providerType === constantsProvider.duo" autocomplete="off">
<div class="header"> <div class="header">
<div class="left"> <div class="left">
<a ui-sref="login({animation: 'out-slide-right'})"><i class="fa fa-chevron-left"></i> {{i18n.login}}</a> <a ui-sref="login({animation: 'out-slide-right'})"><i class="fa fa-chevron-left"></i> {{i18n.back}}</a>
</div> </div>
<div class="title">Duo</div> <div class="title">Duo</div>
</div> </div>
@ -75,7 +75,7 @@
autocomplete="off"> autocomplete="off">
<div class="header"> <div class="header">
<div class="left"> <div class="left">
<a ui-sref="login({animation: 'out-slide-right'})"><i class="fa fa-chevron-left"></i> {{i18n.login}}</a> <a ui-sref="login({animation: 'out-slide-right'})"><i class="fa fa-chevron-left"></i> {{i18n.back}}</a>
</div> </div>
<div class="right"> <div class="right">
<button type="submit" class="btn btn-link" ng-show="!theForm.$loading">{{i18n.continue}}</button> <button type="submit" class="btn btn-link" ng-show="!theForm.$loading">{{i18n.continue}}</button>
@ -112,7 +112,7 @@
<form name="theForm" bit-form="loginPromise" ng-if="providerType === constantsProvider.u2f" autocomplete="off"> <form name="theForm" bit-form="loginPromise" ng-if="providerType === constantsProvider.u2f" autocomplete="off">
<div class="header"> <div class="header">
<div class="left"> <div class="left">
<a ui-sref="login({animation: 'out-slide-right'})"><i class="fa fa-chevron-left"></i> {{i18n.login}}</a> <a ui-sref="login({animation: 'out-slide-right'})"><i class="fa fa-chevron-left"></i> {{i18n.back}}</a>
</div> </div>
<div class="right"> <div class="right">
<i class="fa fa-spinner fa-lg fa-spin" ng-show="theForm.$loading"></i> <i class="fa fa-spinner fa-lg fa-spin" ng-show="theForm.$loading"></i>
@ -147,7 +147,7 @@
<div ng-if="providerType === null"> <div ng-if="providerType === null">
<div class="header"> <div class="header">
<div class="left"> <div class="left">
<a ui-sref="login({animation: 'out-slide-right'})"><i class="fa fa-chevron-left"></i> {{i18n.login}}</a> <a ui-sref="login({animation: 'out-slide-right'})"><i class="fa fa-chevron-left"></i> {{i18n.back}}</a>
</div> </div>
<div class="title">{{i18n.loginUnavailable}}</div> <div class="title">{{i18n.loginUnavailable}}</div>
</div> </div>

View File

@ -1,6 +1,6 @@
<div class="header"> <div class="header">
<div class="left"> <div class="left">
<a ui-sref="tabs.settings({animation: 'out-slide-right'})"><i class="fa fa-chevron-left"></i> {{i18n.settings}}</a> <a ui-sref="tabs.settings({animation: 'out-slide-right'})"><i class="fa fa-chevron-left"></i> {{i18n.back}}</a>
</div> </div>
<div class="title">{{i18n.about}}</div> <div class="title">{{i18n.about}}</div>
</div> </div>

View File

@ -1,6 +1,6 @@
<div class="header"> <div class="header">
<div class="left"> <div class="left">
<a ui-sref="about({animation: 'out-slide-right'})"><i class="fa fa-chevron-left"></i> {{i18n.about}}</a> <a ui-sref="about({animation: 'out-slide-right'})"><i class="fa fa-chevron-left"></i> {{i18n.back}}</a>
</div> </div>
<div class="title">{{i18n.thankYou}}</div> <div class="title">{{i18n.thankYou}}</div>
</div> </div>

View File

@ -1,6 +1,6 @@
<div class="header"> <div class="header">
<div class="left"> <div class="left">
<a ui-sref="tabs.settings({animation: 'out-slide-right'})"><i class="fa fa-chevron-left"></i> {{i18n.settings}}</a> <a ui-sref="tabs.settings({animation: 'out-slide-right'})"><i class="fa fa-chevron-left"></i> {{i18n.back}}</a>
</div> </div>
<div class="title">{{i18n.features}}</div> <div class="title">{{i18n.features}}</div>
</div> </div>

View File

@ -1,6 +1,6 @@
<div class="header"> <div class="header">
<div class="left"> <div class="left">
<a ui-sref="tabs.settings({animation: 'out-slide-right'})"><i class="fa fa-chevron-left"></i> {{i18n.settings}}</a> <a ui-sref="tabs.settings({animation: 'out-slide-right'})"><i class="fa fa-chevron-left"></i> {{i18n.back}}</a>
</div> </div>
<div class="right"> <div class="right">
<a ui-sref="addFolder({animation: 'in-slide-up'})"><i class="fa fa-plus fa-lg"></i></a> <a ui-sref="addFolder({animation: 'in-slide-up'})"><i class="fa fa-plus fa-lg"></i></a>

View File

@ -1,6 +1,6 @@
<div class="header"> <div class="header">
<div class="left"> <div class="left">
<a ui-sref="tabs.settings({animation: 'out-slide-right'})"><i class="fa fa-chevron-left"></i> {{i18n.settings}}</a> <a ui-sref="tabs.settings({animation: 'out-slide-right'})"><i class="fa fa-chevron-left"></i> {{i18n.back}}</a>
</div> </div>
<div class="title">{{i18n.helpFeedback}}</div> <div class="title">{{i18n.helpFeedback}}</div>
</div> </div>

View File

@ -1,6 +1,6 @@
<div class="header"> <div class="header">
<div class="left"> <div class="left">
<a ui-sref="tabs.settings({animation: 'out-slide-right'})"><i class="fa fa-chevron-left"></i> {{i18n.settings}}</a> <a ui-sref="tabs.settings({animation: 'out-slide-right'})"><i class="fa fa-chevron-left"></i> {{i18n.back}}</a>
</div> </div>
<div class="title">{{i18n.premiumMembership}}</div> <div class="title">{{i18n.premiumMembership}}</div>
</div> </div>

View File

@ -1,6 +1,6 @@
<div class="header"> <div class="header">
<div class="left"> <div class="left">
<a ui-sref="tabs.settings({animation: 'out-slide-right'})"><i class="fa fa-chevron-left"></i> {{i18n.settings}}</a> <a ui-sref="tabs.settings({animation: 'out-slide-right'})"><i class="fa fa-chevron-left"></i> {{i18n.back}}</a>
</div> </div>
<div class="title">{{i18n.sync}}</div> <div class="title">{{i18n.sync}}</div>
</div> </div>

View File

@ -2,7 +2,7 @@
.module('bit.tools') .module('bit.tools')
.controller('toolsPasswordGeneratorController', function ($scope, $state, $stateParams, passwordGenerationService, .controller('toolsPasswordGeneratorController', function ($scope, $state, $stateParams, passwordGenerationService,
toastr, $q, utilsService, $analytics, i18nService) { toastr, utilsService, $analytics, i18nService) {
$scope.i18n = i18nService; $scope.i18n = i18nService;
var addState = $stateParams.addState, var addState = $stateParams.addState,
editState = $stateParams.editState; editState = $stateParams.editState;
@ -12,10 +12,11 @@
utilsService.initListSectionItemListeners($(document), angular); utilsService.initListSectionItemListeners($(document), angular);
$scope.password = '-'; $scope.password = '-';
$q.when(passwordGenerationService.getOptions()).then(function (options) { passwordGenerationService.getOptions().then(function (options) {
$scope.options = options; $scope.options = options;
$scope.regenerate(false); $scope.regenerate(false);
$analytics.eventTrack('Generated Password'); $analytics.eventTrack('Generated Password');
passwordGenerationService.addHistory($scope.password);
}); });
$scope.sliderMoved = function () { $scope.sliderMoved = function () {
@ -26,14 +27,16 @@
e.preventDefault(); e.preventDefault();
$analytics.eventTrack('Generated Password'); $analytics.eventTrack('Generated Password');
$scope.saveOptions($scope.options); $scope.saveOptions($scope.options);
passwordGenerationService.addHistory($scope.password);
}); });
$scope.regenerate = function (trackRegenerateEvent) { $scope.regenerate = function (trackEvent) {
if (trackRegenerateEvent) {
$analytics.eventTrack('Regenerated Password');
}
$scope.password = passwordGenerationService.generatePassword($scope.options); $scope.password = passwordGenerationService.generatePassword($scope.options);
if (trackEvent) {
$analytics.eventTrack('Regenerated Password');
passwordGenerationService.addHistory($scope.password);
}
}; };
$scope.saveOptions = function (options) { $scope.saveOptions = function (options) {
@ -57,7 +60,6 @@
}; };
$scope.clipboardSuccess = function (e) { $scope.clipboardSuccess = function (e) {
passwordGenerationService.addHistory(e.text);
$analytics.eventTrack('Copied Generated Password'); $analytics.eventTrack('Copied Generated Password');
e.clearSelection(); e.clearSelection();
toastr.info(i18nService.passwordCopied); toastr.info(i18nService.passwordCopied);

View File

@ -1,10 +1,9 @@
angular angular
.module('bit.tools') .module('bit.tools')
.controller('toolsPasswordGeneratorHistoryController', function ( .controller('toolsPasswordGeneratorHistoryController', function ($scope, $state, $stateParams, toastr, $analytics,
$scope, $state, $stateParams, toastr, $analytics, i18nService, passwordGenerationService) { i18nService, passwordGenerationService) {
$scope.i18n = i18nService; $scope.i18n = i18nService;
$scope.passwords = passwordGenerationService.getHistory(); $scope.passwords = passwordGenerationService.getHistory();
$scope.clipboardError = function (e, password) { $scope.clipboardError = function (e, password) {

View File

@ -22,7 +22,7 @@
{{i18n.copyPassword}} {{i18n.copyPassword}}
</a> </a>
<a class="list-section-item text-primary" href="" ng-click="goHistory()"> <a class="list-section-item text-primary" href="" ng-click="goHistory()">
{{i18n.viewPasswordHistory}} {{i18n.passwordHistory}}
<i class="fa fa-chevron-right fa-lg"></i> <i class="fa fa-chevron-right fa-lg"></i>
</a> </a>
</div> </div>

View File

@ -1,14 +1,13 @@
<div class="header"> <div class="header">
<div class="left"> <div class="left">
<a ng-click="close()" href="">{{i18n.back}}</a> <a ng-click="close()" href=""><i class="fa fa-chevron-left"></i> {{i18n.back}}</a>
</div> </div>
<div class="title">{{i18n.generatePasswordHistory}}</div> <div class="title">{{i18n.passwordHistory}}</div>
</div> </div>
<div class="content"> <div class="content">
<div class="list" style="margin-top: 0;"> <div class="list">
<div class="list-section" ng-if="passwords.length !== 0"> <div class="list-grouped" ng-if="passwords.length !== 0">
<div class="list-section-items"> <div class="list-grouped-item condensed wrap" ng-repeat="password in passwords | orderBy: 'date':true">
<div class="list-section-item list-section-item-checkbox condensed wrap" ng-repeat="password in passwords | orderBy: 'date':true">
<div class="action-buttons"> <div class="action-buttons">
<span class="btn-list" stop-prop stop-click title="{{i18n.copyPassword}}" ngclipboard <span class="btn-list" stop-prop stop-click title="{{i18n.copyPassword}}" ngclipboard
ngclipboard-error="clipboardError(e)" ngclipboard-success="clipboardSuccess(e, i18n.password)" ngclipboard-error="clipboardError(e)" ngclipboard-success="clipboardSuccess(e, i18n.password)"
@ -19,8 +18,7 @@
<span class="text monospaced"> <span class="text monospaced">
{{password.password}} {{password.password}}
</span> </span>
<span class="detail">{{password.date | date}}</span> <span class="detail">{{password.date | date: 'medium'}}</span>
</div>
</div> </div>
</div> </div>
</div> </div>

View File

@ -1,6 +1,6 @@
<div class="header header-search"> <div class="header header-search">
<div class="left"> <div class="left">
<a ui-sref="tabs.vault({animation: 'out-slide-right'})"><i class="fa fa-chevron-left"></i> {{i18n.myVault}}</a> <a ui-sref="tabs.vault({animation: 'out-slide-right'})"><i class="fa fa-chevron-left"></i> {{i18n.back}}</a>
</div> </div>
<div class="search"> <div class="search">
<input type="search" placeholder="{{i18n.searchFolder}}" ng-model="searchText" ng-change="searchCiphers()" id="search" /> <input type="search" placeholder="{{i18n.searchFolder}}" ng-model="searchText" ng-change="searchCiphers()" id="search" />

View File

@ -187,15 +187,14 @@ function initPasswordGenerationService(self) {
}; };
// History // History
var key = self.constantsService.generatedPasswordHistory;
var MAX_PASSWORDS_IN_HISTORY = 10;
self.utilsService var historyKey = self.constantsService.generatedPasswordHistory;
.getObjFromStorage(key) var maxPasswordsInHistory = 100;
.then(function(encrypted) {
self.utilsService.getObjFromStorage(historyKey).then(function (encrypted) {
return decrypt(encrypted); return decrypt(encrypted);
}).then(function(history) { }).then(function (history) {
history.forEach(function(item) { history.forEach(function (item) {
self.history.push(item); self.history.push(item);
}); });
}); });
@ -216,7 +215,7 @@ function initPasswordGenerationService(self) {
}); });
// Remove old items. // Remove old items.
if (self.history.length > MAX_PASSWORDS_IN_HISTORY) { if (self.history.length > maxPasswordsInHistory) {
self.history.shift(); self.history.shift();
} }
@ -225,19 +224,18 @@ function initPasswordGenerationService(self) {
PasswordGenerationService.prototype.clear = function () { PasswordGenerationService.prototype.clear = function () {
self.history = []; self.history = [];
self.utilsService.removeFromStorage(key); self.utilsService.removeFromStorage(historyKey);
}; };
function save() { function save() {
return encryptHistory() return encryptHistory().then(function (history) {
.then(function(history) { return self.utilsService.saveObjToStorage(historyKey, history);
return self.utilsService.saveObjToStorage(key, history);
}); });
} }
function encryptHistory() { function encryptHistory() {
var promises = self.history.map(function(historyItem) { var promises = self.history.map(function (historyItem) {
return self.cryptoService.encrypt(historyItem.password).then(function(encrypted) { return self.cryptoService.encrypt(historyItem.password).then(function (encrypted) {
return { return {
password: encrypted.encryptedString, password: encrypted.encryptedString,
date: historyItem.date date: historyItem.date
@ -249,8 +247,8 @@ function initPasswordGenerationService(self) {
} }
function decrypt(history) { function decrypt(history) {
var promises = history.map(function(item) { var promises = history.map(function (item) {
return self.cryptoService.decrypt(new CipherString(item.password)).then(function(decrypted) { return self.cryptoService.decrypt(new CipherString(item.password)).then(function (decrypted) {
return { return {
password: decrypted, password: decrypted,
date: item.date date: item.date
@ -263,7 +261,6 @@ function initPasswordGenerationService(self) {
function matchesPrevious(password) { function matchesPrevious(password) {
var len = self.history.length; var len = self.history.length;
return len !== 0 && self.history[len-1].password === password; return len !== 0 && self.history[len - 1].password === password;
} }
} }