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": {
"message": "Identity"
},
"viewPasswordHistory": {
"message": "View Password History"
},
"generatePasswordHistory": {
"message": "Generated Passwords History"
"passwordHistory": {
"message": "Password History"
},
"back": {
"message": "Back"

View File

@ -1,7 +1,7 @@
<form name="theForm" ng-submit="submit(model)" bit-form="submitPromise">
<div class="header">
<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 class="right">
<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">
<div class="header">
<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 class="right">
<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">
<div class="header">
<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 class="title">Duo</div>
</div>
@ -75,7 +75,7 @@
autocomplete="off">
<div class="header">
<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 class="right">
<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">
<div class="header">
<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 class="right">
<i class="fa fa-spinner fa-lg fa-spin" ng-show="theForm.$loading"></i>
@ -147,7 +147,7 @@
<div ng-if="providerType === null">
<div class="header">
<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 class="title">{{i18n.loginUnavailable}}</div>
</div>

View File

@ -1,6 +1,6 @@
<div class="header">
<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 class="title">{{i18n.about}}</div>
</div>

View File

@ -1,6 +1,6 @@
<div class="header">
<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 class="title">{{i18n.thankYou}}</div>
</div>

View File

@ -1,6 +1,6 @@
<div class="header">
<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 class="title">{{i18n.features}}</div>
</div>

View File

@ -1,6 +1,6 @@
<div class="header">
<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 class="right">
<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="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 class="title">{{i18n.helpFeedback}}</div>
</div>

View File

@ -1,6 +1,6 @@
<div class="header">
<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 class="title">{{i18n.premiumMembership}}</div>
</div>

View File

@ -1,6 +1,6 @@
<div class="header">
<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 class="title">{{i18n.sync}}</div>
</div>

View File

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

View File

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

View File

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

View File

@ -1,26 +1,24 @@
<div class="header">
<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 class="title">{{i18n.generatePasswordHistory}}</div>
<div class="title">{{i18n.passwordHistory}}</div>
</div>
<div class="content">
<div class="list" style="margin-top: 0;">
<div class="list-section" ng-if="passwords.length !== 0">
<div class="list-section-items">
<div class="list-section-item list-section-item-checkbox condensed wrap" ng-repeat="password in passwords | orderBy: 'date':true">
<div class="action-buttons">
<span class="btn-list" stop-prop stop-click title="{{i18n.copyPassword}}" ngclipboard
ngclipboard-error="clipboardError(e)" ngclipboard-success="clipboardSuccess(e, i18n.password)"
data-clipboard-text="{{password.password}}">
<i class="fa fa-lg fa-clipboard"></i>
</span>
</div>
<span class="text monospaced">
{{password.password}}
<div class="list">
<div class="list-grouped" ng-if="passwords.length !== 0">
<div class="list-grouped-item condensed wrap" ng-repeat="password in passwords | orderBy: 'date':true">
<div class="action-buttons">
<span class="btn-list" stop-prop stop-click title="{{i18n.copyPassword}}" ngclipboard
ngclipboard-error="clipboardError(e)" ngclipboard-success="clipboardSuccess(e, i18n.password)"
data-clipboard-text="{{password.password}}">
<i class="fa fa-lg fa-clipboard"></i>
</span>
<span class="detail">{{password.date | date}}</span>
</div>
<span class="text monospaced">
{{password.password}}
</span>
<span class="detail">{{password.date | date: 'medium'}}</span>
</div>
</div>
</div>

View File

@ -1,6 +1,6 @@
<div class="header header-search">
<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 class="search">
<input type="search" placeholder="{{i18n.searchFolder}}" ng-model="searchText" ng-change="searchCiphers()" id="search" />

View File

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