mirror of
https://github.com/bitwarden/browser
synced 2025-12-12 14:23:32 +00:00
vault listing page fixes
This commit is contained in:
@@ -278,17 +278,13 @@ function buildDomainModel(model, obj, map, alreadyEncrypted, notEncList) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
(function () {
|
(function () {
|
||||||
var bg = chrome.extension.getBackgroundPage(),
|
|
||||||
cryptoService = bg ? bg.bg_cryptoService : null;
|
|
||||||
|
|
||||||
CipherString.prototype.decrypt = function (orgId) {
|
CipherString.prototype.decrypt = function (orgId) {
|
||||||
if (this.decryptedValue) {
|
if (this.decryptedValue) {
|
||||||
var deferred = Q.defer();
|
return Q(this.decryptedValue);
|
||||||
deferred.resolve(this.decryptedValue);
|
|
||||||
return deferred.promise;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var self = this;
|
var self = this,
|
||||||
|
cryptoService = chrome.extension.getBackgroundPage().bg_cryptoService;
|
||||||
return cryptoService.getOrgKey(orgId).then(function (orgKey) {
|
return cryptoService.getOrgKey(orgId).then(function (orgKey) {
|
||||||
return cryptoService.decrypt(self, orgKey);
|
return cryptoService.decrypt(self, orgKey);
|
||||||
}).then(function (decValue) {
|
}).then(function (decValue) {
|
||||||
@@ -416,15 +412,19 @@ function buildDomainModel(model, obj, map, alreadyEncrypted, notEncList) {
|
|||||||
switch (self.type) {
|
switch (self.type) {
|
||||||
case 1: // cipherType.login
|
case 1: // cipherType.login
|
||||||
model.login = decObj;
|
model.login = decObj;
|
||||||
|
model.subTitle = model.login.username;
|
||||||
break;
|
break;
|
||||||
case 2: // cipherType.secureNote
|
case 2: // cipherType.secureNote
|
||||||
model.secureNote = decObj;
|
model.secureNote = decObj;
|
||||||
|
model.subTitle = '-';
|
||||||
break;
|
break;
|
||||||
case 3: // cipherType.card
|
case 3: // cipherType.card
|
||||||
model.card = decObj;
|
model.card = decObj;
|
||||||
|
model.subTitle = model.identity.brand;
|
||||||
break;
|
break;
|
||||||
case 4: // cipherType.identity
|
case 4: // cipherType.identity
|
||||||
model.identity = decObj;
|
model.identity = decObj;
|
||||||
|
model.subTitle = model.identity.firstName;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|||||||
18
src/popup/app/components/actionButtonsComponent.js
Normal file
18
src/popup/app/components/actionButtonsComponent.js
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
angular
|
||||||
|
.module('bit.components')
|
||||||
|
|
||||||
|
.component('actionButtonsComponent', {
|
||||||
|
bindings: {
|
||||||
|
uri: '<'
|
||||||
|
},
|
||||||
|
template: '',
|
||||||
|
controller: function (stateService) {
|
||||||
|
this.$onInit = (function () {
|
||||||
|
|
||||||
|
}).bind(this);
|
||||||
|
|
||||||
|
this.$onChanges = (function () {
|
||||||
|
|
||||||
|
}).bind(this);
|
||||||
|
}
|
||||||
|
});
|
||||||
@@ -1,13 +1,14 @@
|
|||||||
angular
|
angular
|
||||||
.module('bit.components')
|
.module('bit.components')
|
||||||
|
|
||||||
.component('icon', {
|
.component('icon', {
|
||||||
bindings: {
|
bindings: {
|
||||||
uri: '<'
|
uri: '<'
|
||||||
},
|
},
|
||||||
template: '<div class="icon" ng-if="$ctrl.enabled()"><img src="{{$ctrl.url}}"></div>',
|
template: '<div class="icon" ng-if="$ctrl.enabled()"><img src="{{$ctrl.url}}"></div>',
|
||||||
controller: function(stateService) {
|
controller: function (stateService) {
|
||||||
this.$onInit = (function() {
|
this.$onInit = (function () {
|
||||||
this.enabled = function() {
|
this.enabled = function () {
|
||||||
return stateService.getState('faviconEnabled');
|
return stateService.getState('faviconEnabled');
|
||||||
};
|
};
|
||||||
}).bind(this);
|
}).bind(this);
|
||||||
|
|||||||
@@ -51,11 +51,11 @@
|
|||||||
});
|
});
|
||||||
promises.push(folderPromise);
|
promises.push(folderPromise);
|
||||||
|
|
||||||
var loginPromise = $q.when(loginService.getAllDecrypted());
|
var cipherPromise = loginService.getAllDecrypted();
|
||||||
loginPromise.then(function (logins) {
|
cipherPromise.then(function (ciphers) {
|
||||||
decLogins = logins;
|
decLogins = ciphers;
|
||||||
});
|
});
|
||||||
promises.push(loginPromise);
|
promises.push(cipherPromise);
|
||||||
|
|
||||||
$q.all(promises).then(function () {
|
$q.all(promises).then(function () {
|
||||||
$scope.loaded = true;
|
$scope.loaded = true;
|
||||||
|
|||||||
@@ -39,17 +39,17 @@
|
|||||||
promises.push(folderDeferred.promise);
|
promises.push(folderDeferred.promise);
|
||||||
}
|
}
|
||||||
|
|
||||||
var loginPromise = $q.when(loginService.getAllDecryptedForFolder($scope.folder.id));
|
var cipherPromise = loginService.getAllDecryptedForFolder($scope.folder.id);
|
||||||
loginPromise.then(function (logins) {
|
cipherPromise.then(function (ciphers) {
|
||||||
if (utilsService.isEdge()) {
|
if (utilsService.isEdge()) {
|
||||||
// Edge is super slow at sorting
|
// Edge is super slow at sorting
|
||||||
decLogins = logins;
|
decLogins = ciphers;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
decLogins = logins.sort(loginSort);
|
decLogins = ciphers.sort(cipherSort);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
promises.push(loginPromise);
|
promises.push(cipherPromise);
|
||||||
|
|
||||||
$q.all(promises).then(function () {
|
$q.all(promises).then(function () {
|
||||||
$scope.loaded = true;
|
$scope.loaded = true;
|
||||||
@@ -68,7 +68,7 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function loginSort(a, b) {
|
function cipherSort(a, b) {
|
||||||
if (!a.name) {
|
if (!a.name) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@@ -85,19 +85,19 @@
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!a.username) {
|
if (!a.subTitle) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (!b.username) {
|
if (!b.subTitle) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
var aUsername = a.username.toLowerCase(),
|
var aSubTitle = a.subTitle.toLowerCase(),
|
||||||
bUsername = b.username.toLowerCase();
|
bSubTitle = b.subTitle.toLowerCase();
|
||||||
if (aUsername > bUsername) {
|
if (aSubTitle > bSubTitle) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
if (aUsername < bUsername) {
|
if (aSubTitle < bSubTitle) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -123,7 +123,7 @@
|
|||||||
|
|
||||||
var matchedLogins = [];
|
var matchedLogins = [];
|
||||||
for (var i = 0; i < decLogins.length; i++) {
|
for (var i = 0; i < decLogins.length; i++) {
|
||||||
if (searchLogin(decLogins[i])) {
|
if (searchCipher(decLogins[i])) {
|
||||||
matchedLogins.push(decLogins[i]);
|
matchedLogins.push(decLogins[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -149,15 +149,15 @@
|
|||||||
$scope.loadMore();
|
$scope.loadMore();
|
||||||
}
|
}
|
||||||
|
|
||||||
function searchLogin(login) {
|
function searchCipher(cipher) {
|
||||||
var searchTerm = $scope.searchText.toLowerCase();
|
var searchTerm = $scope.searchText.toLowerCase();
|
||||||
if (login.name && login.name.toLowerCase().indexOf(searchTerm) !== -1) {
|
if (cipher.name && cipher.name.toLowerCase().indexOf(searchTerm) !== -1) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (login.username && login.username.toLowerCase().indexOf(searchTerm) !== -1) {
|
if (cipher.subTitle && cipher.subTitle.toLowerCase().indexOf(searchTerm) !== -1) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (login.uri && login.uri.toLowerCase().indexOf(searchTerm) !== -1) {
|
if (cipher.login && cipher.login.uri && cipher.login.uri.toLowerCase().indexOf(searchTerm) !== -1) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -40,7 +40,7 @@
|
|||||||
<a href="#" stop-click ng-click="viewLogin(login)"
|
<a href="#" stop-click ng-click="viewLogin(login)"
|
||||||
class="list-grouped-item condensed" title="{{i18n.edit}} {{login.name}}"
|
class="list-grouped-item condensed" title="{{i18n.edit}} {{login.name}}"
|
||||||
ng-repeat="login in vaultFolderLogins = (vaultLogins | filter: { folderId: folder.id }
|
ng-repeat="login in vaultFolderLogins = (vaultLogins | filter: { folderId: folder.id }
|
||||||
| filter: searchLogins() | orderBy: ['name', 'username']) track by $index">
|
| filter: searchLogins() | orderBy: ['name', 'subTitle']) track by $index">
|
||||||
<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)"
|
||||||
data-clipboard-text="{{login.password}}" ng-class="{'disabled': !login.password}">
|
data-clipboard-text="{{login.password}}" ng-class="{'disabled': !login.password}">
|
||||||
@@ -61,7 +61,7 @@
|
|||||||
<i class="fa fa-share-alt text-muted" ng-if="login.organizationId" title="{{i18n.shared}}"></i>
|
<i class="fa fa-share-alt text-muted" ng-if="login.organizationId" title="{{i18n.shared}}"></i>
|
||||||
<i class="fa fa-paperclip text-muted" ng-if="login.attachments" title="{{i18n.attachments}}"></i>
|
<i class="fa fa-paperclip text-muted" ng-if="login.attachments" title="{{i18n.attachments}}"></i>
|
||||||
</span>
|
</span>
|
||||||
<span class="detail">{{login.username}}</span>
|
<span class="detail">{{login.subTitle}}</span>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -72,7 +72,7 @@
|
|||||||
<div class="list-section" style="padding-top: 0; padding-bottom: 0;">
|
<div class="list-section" style="padding-top: 0; padding-bottom: 0;">
|
||||||
<a href="#" stop-click ng-click="viewLogin(login)"
|
<a href="#" stop-click ng-click="viewLogin(login)"
|
||||||
class="list-section-item condensed" title="{{i18n.edit}} {{login.name}}"
|
class="list-section-item condensed" title="{{i18n.edit}} {{login.name}}"
|
||||||
ng-repeat="login in searchResults = (vaultLogins | filter: searchLogins() | orderBy: ['name', 'username'])
|
ng-repeat="login in searchResults = (vaultLogins | filter: searchLogins() | orderBy: ['name', 'subTitle'])
|
||||||
track by $index">
|
track by $index">
|
||||||
<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)"
|
||||||
@@ -94,7 +94,7 @@
|
|||||||
<i class="fa fa-share-alt text-muted" ng-if="login.organizationId" title="{{i18n.shared}}"></i>
|
<i class="fa fa-share-alt text-muted" ng-if="login.organizationId" title="{{i18n.shared}}"></i>
|
||||||
<i class="fa fa-paperclip text-muted" ng-if="login.attachments" title="{{i18n.attachments}}"></i>
|
<i class="fa fa-paperclip text-muted" ng-if="login.attachments" title="{{i18n.attachments}}"></i>
|
||||||
</span>
|
</span>
|
||||||
<span class="detail">{{login.username}}</span>
|
<span class="detail">{{login.subTitle}}</span>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -61,6 +61,7 @@
|
|||||||
|
|
||||||
<script src="app/components/componentsModule.js"></script>
|
<script src="app/components/componentsModule.js"></script>
|
||||||
<script src="app/components/iconComponent.js"></script>
|
<script src="app/components/iconComponent.js"></script>
|
||||||
|
<script src="app/components/actionButtonsComponent.js"></script>
|
||||||
|
|
||||||
<script src="app/services/servicesModule.js"></script>
|
<script src="app/services/servicesModule.js"></script>
|
||||||
<script src="app/services/backgroundService.js"></script>
|
<script src="app/services/backgroundService.js"></script>
|
||||||
|
|||||||
@@ -182,7 +182,7 @@ function initLoginService() {
|
|||||||
key = null,
|
key = null,
|
||||||
localData = null;
|
localData = null;
|
||||||
|
|
||||||
self.userService.getUserIdPromise().then(function (userId) {
|
return self.userService.getUserIdPromise().then(function (userId) {
|
||||||
key = 'ciphers_' + userId;
|
key = 'ciphers_' + userId;
|
||||||
return self.utilsService.getObjFromStorage(self.localDataKey);
|
return self.utilsService.getObjFromStorage(self.localDataKey);
|
||||||
}).then(function (data) {
|
}).then(function (data) {
|
||||||
@@ -191,11 +191,11 @@ function initLoginService() {
|
|||||||
localData = {};
|
localData = {};
|
||||||
}
|
}
|
||||||
return self.utilsService.getObjFromStorage(key);
|
return self.utilsService.getObjFromStorage(key);
|
||||||
}).then(function (logins) {
|
}).then(function (ciphers) {
|
||||||
var response = [];
|
var response = [];
|
||||||
for (var id in logins) {
|
for (var id in ciphers) {
|
||||||
if (id) {
|
if (id) {
|
||||||
response.push(new Login(logins[id], false, localData[id]));
|
response.push(new Cipher(ciphers[id], false, localData[id]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -205,7 +205,7 @@ function initLoginService() {
|
|||||||
|
|
||||||
LoginService.prototype.getAllDecrypted = function () {
|
LoginService.prototype.getAllDecrypted = function () {
|
||||||
var self = this,
|
var self = this,
|
||||||
decLogins = [];
|
decCiphers = [];
|
||||||
|
|
||||||
return self.cryptoService.getKey().then(function (key) {
|
return self.cryptoService.getKey().then(function (key) {
|
||||||
if (!key) {
|
if (!key) {
|
||||||
@@ -219,19 +219,19 @@ function initLoginService() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return self.getAll();
|
return self.getAll();
|
||||||
}).then(function (logins) {
|
}).then(function (ciphers) {
|
||||||
var promises = [];
|
var promises = [];
|
||||||
for (var i = 0; i < logins.length; i++) {
|
for (var i = 0; i < ciphers.length; i++) {
|
||||||
/* jshint ignore:start */
|
/* jshint ignore:start */
|
||||||
promises.push(logins[i].decrypt().then(function (login) {
|
promises.push(ciphers[i].decrypt().then(function (cipher) {
|
||||||
decLogins.push(login);
|
decCiphers.push(cipher);
|
||||||
}));
|
}));
|
||||||
/* jshint ignore:end */
|
/* jshint ignore:end */
|
||||||
}
|
}
|
||||||
|
|
||||||
return Q.all(promises);
|
return Q.all(promises);
|
||||||
}).then(function () {
|
}).then(function () {
|
||||||
self.decryptedCipherCache = decLogins;
|
self.decryptedCipherCache = decCiphers;
|
||||||
return self.decryptedCipherCache;
|
return self.decryptedCipherCache;
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -139,14 +139,11 @@ function initSyncService() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function syncCiphers(self, userId, response) {
|
function syncCiphers(self, userId, response) {
|
||||||
var logins = {};
|
var ciphers = {};
|
||||||
for (var i = 0; i < response.length; i++) {
|
for (var i = 0; i < response.length; i++) {
|
||||||
var data = response[i];
|
ciphers[response[i].id] = new CipherData(response[i], userId);
|
||||||
if (data.type === 1) {
|
|
||||||
logins[data.id] = new LoginData(data, userId);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return self.loginService.replace(logins);
|
return self.loginService.replace(ciphers);
|
||||||
}
|
}
|
||||||
|
|
||||||
function syncSettings(self, userId, response) {
|
function syncSettings(self, userId, response) {
|
||||||
|
|||||||
Reference in New Issue
Block a user