mirror of
https://github.com/bitwarden/browser.git
synced 2025-02-12 00:41:29 +01:00
refactor for cipher response. add login uris.
This commit is contained in:
parent
b94c62d1e5
commit
5c92350ed2
@ -8,7 +8,13 @@
|
|||||||
$scope.selectedType = constants.cipherType.login.toString();
|
$scope.selectedType = constants.cipherType.login.toString();
|
||||||
$scope.cipher = {
|
$scope.cipher = {
|
||||||
type: constants.cipherType.login,
|
type: constants.cipherType.login,
|
||||||
login: {},
|
login: {
|
||||||
|
uris: [{
|
||||||
|
uri: null,
|
||||||
|
match: null,
|
||||||
|
matchValue: null
|
||||||
|
}]
|
||||||
|
},
|
||||||
identity: {},
|
identity: {},
|
||||||
card: {},
|
card: {},
|
||||||
secureNote: {
|
secureNote: {
|
||||||
@ -44,6 +50,42 @@
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
$scope.addUri = function () {
|
||||||
|
if (!$scope.cipher.login) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$scope.cipher.login.uris) {
|
||||||
|
$scope.cipher.login.uris = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
$scope.cipher.login.uris.push({
|
||||||
|
uri: null,
|
||||||
|
match: null,
|
||||||
|
matchValue: null
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
$scope.removeUri = function (uri) {
|
||||||
|
if (!$scope.cipher.login || !$scope.cipher.login.uris) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var index = $scope.cipher.login.uris.indexOf(uri);
|
||||||
|
if (index > -1) {
|
||||||
|
$scope.cipher.login.uris.splice(index, 1);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
$scope.uriMatchChanged = function (uri) {
|
||||||
|
if ((!uri.matchValue && uri.matchValue !== 0) || uri.matchValue === '') {
|
||||||
|
uri.match = null;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
uri.match = parseInt(uri.matchValue);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
$scope.addField = function () {
|
$scope.addField = function () {
|
||||||
if (!$scope.cipher.fields) {
|
if (!$scope.cipher.fields) {
|
||||||
$scope.cipher.fields = [];
|
$scope.cipher.fields = [];
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
apiService.ciphers.getAdmin({ id: cipherId }, function (cipher) {
|
apiService.ciphers.getAdmin({ id: cipherId }, function (cipher) {
|
||||||
$scope.cipher = cipherService.decryptCipher(cipher);
|
$scope.cipher = cipherService.decryptCipher(cipher);
|
||||||
$scope.useTotp = $scope.cipher.organizationUseTotp;
|
$scope.useTotp = $scope.cipher.organizationUseTotp;
|
||||||
|
setUriMatchValues();
|
||||||
});
|
});
|
||||||
|
|
||||||
$scope.save = function (model) {
|
$scope.save = function (model) {
|
||||||
@ -32,6 +33,42 @@
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
$scope.addUri = function () {
|
||||||
|
if (!$scope.cipher.login) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$scope.cipher.login.uris) {
|
||||||
|
$scope.cipher.login.uris = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
$scope.cipher.login.uris.push({
|
||||||
|
uri: null,
|
||||||
|
match: null,
|
||||||
|
matchValue: null
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
$scope.removeUri = function (uri) {
|
||||||
|
if (!$scope.cipher.login || !$scope.cipher.login.uris) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var index = $scope.cipher.login.uris.indexOf(uri);
|
||||||
|
if (index > -1) {
|
||||||
|
$scope.cipher.login.uris.splice(index, 1);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
$scope.uriMatchChanged = function (uri) {
|
||||||
|
if ((!uri.matchValue && uri.matchValue !== 0) || uri.matchValue === '') {
|
||||||
|
uri.match = null;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
uri.match = parseInt(uri.matchValue);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
$scope.addField = function () {
|
$scope.addField = function () {
|
||||||
if (!$scope.cipher.login.fields) {
|
if (!$scope.cipher.login.fields) {
|
||||||
$scope.cipher.login.fields = [];
|
$scope.cipher.login.fields = [];
|
||||||
@ -98,4 +135,14 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
function setUriMatchValues() {
|
||||||
|
if ($scope.cipher.login && $scope.cipher.login.uris) {
|
||||||
|
for (var i = 0; i < $scope.cipher.login.uris.length; i++) {
|
||||||
|
$scope.cipher.login.uris[i].matchValue =
|
||||||
|
$scope.cipher.login.uris[i].match || $scope.cipher.login.uris[i].match === 0 ?
|
||||||
|
$scope.cipher.login.uris[i].match.toString() : '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
@ -30,6 +30,9 @@ angular
|
|||||||
organizationId: encryptedCipher.OrganizationId,
|
organizationId: encryptedCipher.OrganizationId,
|
||||||
collectionIds: encryptedCipher.CollectionIds || [],
|
collectionIds: encryptedCipher.CollectionIds || [],
|
||||||
'type': encryptedCipher.Type,
|
'type': encryptedCipher.Type,
|
||||||
|
name: cryptoService.decrypt(encryptedCipher.Name, key),
|
||||||
|
notes: _service.decryptProperty(encryptedCipher.Notes, key, true, false),
|
||||||
|
fields: _service.decryptFields(key, encryptedCipher.Fields),
|
||||||
folderId: encryptedCipher.FolderId,
|
folderId: encryptedCipher.FolderId,
|
||||||
favorite: encryptedCipher.Favorite,
|
favorite: encryptedCipher.Favorite,
|
||||||
edit: encryptedCipher.Edit,
|
edit: encryptedCipher.Edit,
|
||||||
@ -38,62 +41,68 @@ angular
|
|||||||
icon: null
|
icon: null
|
||||||
};
|
};
|
||||||
|
|
||||||
var cipherData = encryptedCipher.Data;
|
var i;
|
||||||
if (cipherData) {
|
switch (cipher.type) {
|
||||||
cipher.name = cryptoService.decrypt(cipherData.Name, key);
|
case constants.cipherType.login:
|
||||||
cipher.notes = _service.decryptProperty(cipherData.Notes, key, true, false);
|
cipher.login = {
|
||||||
cipher.fields = _service.decryptFields(key, cipherData.Fields);
|
username: _service.decryptProperty(encryptedCipher.Login.Username, key, true, false),
|
||||||
|
password: _service.decryptProperty(encryptedCipher.Login.Password, key, true, false),
|
||||||
var dataObj = {};
|
totp: _service.decryptProperty(encryptedCipher.Login.Totp, key, true, false),
|
||||||
switch (cipher.type) {
|
uris: null
|
||||||
case constants.cipherType.login:
|
};
|
||||||
dataObj.uri = _service.decryptProperty(cipherData.Uri, key, true, false);
|
if (encryptedCipher.Login.Uris) {
|
||||||
dataObj.username = _service.decryptProperty(cipherData.Username, key, true, false);
|
cipher.login.uris = [];
|
||||||
dataObj.password = _service.decryptProperty(cipherData.Password, key, true, false);
|
for (i = 0; i < encryptedCipher.Login.Uris.length; i++) {
|
||||||
dataObj.totp = _service.decryptProperty(cipherData.Totp, key, true, false);
|
cipher.login.uris.push({
|
||||||
cipher.login = dataObj;
|
uri: _service.decryptProperty(encryptedCipher.Login.Uris[i].Uri, key, true, false),
|
||||||
cipher.icon = 'fa-globe';
|
match: encryptedCipher.Login.Uris[i].Match
|
||||||
break;
|
});
|
||||||
case constants.cipherType.secureNote:
|
}
|
||||||
dataObj.type = cipherData.Type;
|
}
|
||||||
cipher.secureNote = dataObj;
|
cipher.icon = 'fa-globe';
|
||||||
cipher.icon = 'fa-sticky-note-o';
|
break;
|
||||||
break;
|
case constants.cipherType.secureNote:
|
||||||
case constants.cipherType.card:
|
cipher.secureNote = {
|
||||||
dataObj.cardholderName = _service.decryptProperty(cipherData.CardholderName, key, true, false);
|
type: encryptedCipher.SecureNote.Type
|
||||||
dataObj.number = _service.decryptProperty(cipherData.Number, key, true, false);
|
};
|
||||||
dataObj.brand = _service.decryptProperty(cipherData.Brand, key, true, false);
|
cipher.icon = 'fa-sticky-note-o';
|
||||||
dataObj.expMonth = _service.decryptProperty(cipherData.ExpMonth, key, true, false);
|
break;
|
||||||
dataObj.expYear = _service.decryptProperty(cipherData.ExpYear, key, true, false);
|
case constants.cipherType.card:
|
||||||
dataObj.code = _service.decryptProperty(cipherData.Code, key, true, false);
|
cipher.card = {
|
||||||
cipher.card = dataObj;
|
cardholderName: _service.decryptProperty(encryptedCipher.Card.CardholderName, key, true, false),
|
||||||
cipher.icon = 'fa-credit-card';
|
number: _service.decryptProperty(encryptedCipher.Card.Number, key, true, false),
|
||||||
break;
|
brand: _service.decryptProperty(encryptedCipher.Card.Brand, key, true, false),
|
||||||
case constants.cipherType.identity:
|
expMonth: _service.decryptProperty(encryptedCipher.Card.ExpMonth, key, true, false),
|
||||||
dataObj.title = _service.decryptProperty(cipherData.Title, key, true, false);
|
expYear: _service.decryptProperty(encryptedCipher.Card.ExpYear, key, true, false),
|
||||||
dataObj.firstName = _service.decryptProperty(cipherData.FirstName, key, true, false);
|
code: _service.decryptProperty(encryptedCipher.Card.Code, key, true, false)
|
||||||
dataObj.middleName = _service.decryptProperty(cipherData.MiddleName, key, true, false);
|
};
|
||||||
dataObj.lastName = _service.decryptProperty(cipherData.LastName, key, true, false);
|
cipher.icon = 'fa-credit-card';
|
||||||
dataObj.address1 = _service.decryptProperty(cipherData.Address1, key, true, false);
|
break;
|
||||||
dataObj.address2 = _service.decryptProperty(cipherData.Address2, key, true, false);
|
case constants.cipherType.identity:
|
||||||
dataObj.address3 = _service.decryptProperty(cipherData.Address3, key, true, false);
|
cipher.identity = {
|
||||||
dataObj.city = _service.decryptProperty(cipherData.City, key, true, false);
|
title: _service.decryptProperty(encryptedCipher.Identity.Title, key, true, false),
|
||||||
dataObj.state = _service.decryptProperty(cipherData.State, key, true, false);
|
firstName: _service.decryptProperty(encryptedCipher.Identity.FirstName, key, true, false),
|
||||||
dataObj.postalCode = _service.decryptProperty(cipherData.PostalCode, key, true, false);
|
middleName: _service.decryptProperty(encryptedCipher.Identity.MiddleName, key, true, false),
|
||||||
dataObj.country = _service.decryptProperty(cipherData.Country, key, true, false);
|
lastName: _service.decryptProperty(encryptedCipher.Identity.LastName, key, true, false),
|
||||||
dataObj.company = _service.decryptProperty(cipherData.Company, key, true, false);
|
address1: _service.decryptProperty(encryptedCipher.Identity.Address1, key, true, false),
|
||||||
dataObj.email = _service.decryptProperty(cipherData.Email, key, true, false);
|
address2: _service.decryptProperty(encryptedCipher.Identity.Address2, key, true, false),
|
||||||
dataObj.phone = _service.decryptProperty(cipherData.Phone, key, true, false);
|
address3: _service.decryptProperty(encryptedCipher.Identity.Address3, key, true, false),
|
||||||
dataObj.ssn = _service.decryptProperty(cipherData.SSN, key, true, false);
|
city: _service.decryptProperty(encryptedCipher.Identity.City, key, true, false),
|
||||||
dataObj.username = _service.decryptProperty(cipherData.Username, key, true, false);
|
state: _service.decryptProperty(encryptedCipher.Identity.State, key, true, false),
|
||||||
dataObj.passportNumber = _service.decryptProperty(cipherData.PassportNumber, key, true, false);
|
postalCode: _service.decryptProperty(encryptedCipher.Identity.PostalCode, key, true, false),
|
||||||
dataObj.licenseNumber = _service.decryptProperty(cipherData.LicenseNumber, key, true, false);
|
country: _service.decryptProperty(encryptedCipher.Identity.Country, key, true, false),
|
||||||
cipher.identity = dataObj;
|
company: _service.decryptProperty(encryptedCipher.Identity.Company, key, true, false),
|
||||||
cipher.icon = 'fa-id-card-o';
|
email: _service.decryptProperty(encryptedCipher.Identity.Email, key, true, false),
|
||||||
break;
|
phone: _service.decryptProperty(encryptedCipher.Identity.Phone, key, true, false),
|
||||||
default:
|
ssn: _service.decryptProperty(encryptedCipher.Identity.SSN, key, true, false),
|
||||||
break;
|
username: _service.decryptProperty(encryptedCipher.Identity.Username, key, true, false),
|
||||||
}
|
passportNumber: _service.decryptProperty(encryptedCipher.Identity.PassportNumber, key, true, false),
|
||||||
|
licenseNumber: _service.decryptProperty(encryptedCipher.Identity.LicenseNumber, key, true, false)
|
||||||
|
};
|
||||||
|
cipher.icon = 'fa-id-card-o';
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!encryptedCipher.Attachments) {
|
if (!encryptedCipher.Attachments) {
|
||||||
@ -101,7 +110,7 @@ angular
|
|||||||
}
|
}
|
||||||
|
|
||||||
cipher.attachments = [];
|
cipher.attachments = [];
|
||||||
for (var i = 0; i < encryptedCipher.Attachments.length; i++) {
|
for (i = 0; i < encryptedCipher.Attachments.length; i++) {
|
||||||
cipher.attachments.push(_service.decryptAttachment(key, encryptedCipher.Attachments[i]));
|
cipher.attachments.push(_service.decryptAttachment(key, encryptedCipher.Attachments[i]));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -121,6 +130,7 @@ angular
|
|||||||
organizationId: encryptedCipher.OrganizationId,
|
organizationId: encryptedCipher.OrganizationId,
|
||||||
collectionIds: encryptedCipher.CollectionIds || [],
|
collectionIds: encryptedCipher.CollectionIds || [],
|
||||||
'type': encryptedCipher.Type,
|
'type': encryptedCipher.Type,
|
||||||
|
name: _service.decryptProperty(encryptedCipher.Name, key, false, true),
|
||||||
folderId: encryptedCipher.FolderId,
|
folderId: encryptedCipher.FolderId,
|
||||||
favorite: encryptedCipher.Favorite,
|
favorite: encryptedCipher.Favorite,
|
||||||
edit: encryptedCipher.Edit,
|
edit: encryptedCipher.Edit,
|
||||||
@ -130,59 +140,56 @@ angular
|
|||||||
icon: null
|
icon: null
|
||||||
};
|
};
|
||||||
|
|
||||||
var cipherData = encryptedCipher.Data;
|
switch (cipher.type) {
|
||||||
if (cipherData) {
|
case constants.cipherType.login:
|
||||||
cipher.name = _service.decryptProperty(cipherData.Name, key, false, true);
|
cipher.subTitle = _service.decryptProperty(encryptedCipher.Login.Username, key, true, true);
|
||||||
|
cipher.meta.password = _service.decryptProperty(encryptedCipher.Login.Password, key, true, true);
|
||||||
var dataObj = {};
|
cipher.meta.uri = null;
|
||||||
switch (cipher.type) {
|
if (encryptedCipher.Login.Uris && encryptedCipher.Login.Uris.length) {
|
||||||
case constants.cipherType.login:
|
cipher.meta.uri = _service.decryptProperty(encryptedCipher.Login.Uris[0].Uri, key, true, true);
|
||||||
cipher.subTitle = _service.decryptProperty(cipherData.Username, key, true, true);
|
}
|
||||||
cipher.meta.password = _service.decryptProperty(cipherData.Password, key, true, true);
|
setLoginIcon(cipher, cipher.meta.uri, true);
|
||||||
cipher.meta.uri = _service.decryptProperty(cipherData.Uri, key, true, true);
|
break;
|
||||||
setLoginIcon(cipher, cipher.meta.uri, true);
|
case constants.cipherType.secureNote:
|
||||||
break;
|
|
||||||
case constants.cipherType.secureNote:
|
|
||||||
cipher.subTitle = null;
|
|
||||||
cipher.icon = 'fa-sticky-note-o';
|
|
||||||
break;
|
|
||||||
case constants.cipherType.card:
|
|
||||||
cipher.subTitle = '';
|
|
||||||
cipher.meta.number = _service.decryptProperty(cipherData.Number, key, true, true);
|
|
||||||
var brand = _service.decryptProperty(cipherData.Brand, key, true, true);
|
|
||||||
if (brand) {
|
|
||||||
cipher.subTitle = brand;
|
|
||||||
}
|
|
||||||
if (cipher.meta.number && cipher.meta.number.length >= 4) {
|
|
||||||
if (cipher.subTitle !== '') {
|
|
||||||
cipher.subTitle += ', ';
|
|
||||||
}
|
|
||||||
cipher.subTitle += ('*' + cipher.meta.number.substr(cipher.meta.number.length - 4));
|
|
||||||
}
|
|
||||||
cipher.icon = 'fa-credit-card';
|
|
||||||
break;
|
|
||||||
case constants.cipherType.identity:
|
|
||||||
var firstName = _service.decryptProperty(cipherData.FirstName, key, true, true);
|
|
||||||
var lastName = _service.decryptProperty(cipherData.LastName, key, true, true);
|
|
||||||
cipher.subTitle = '';
|
|
||||||
if (firstName) {
|
|
||||||
cipher.subTitle = firstName;
|
|
||||||
}
|
|
||||||
if (lastName) {
|
|
||||||
if (cipher.subTitle !== '') {
|
|
||||||
cipher.subTitle += ' ';
|
|
||||||
}
|
|
||||||
cipher.subTitle += lastName;
|
|
||||||
}
|
|
||||||
cipher.icon = 'fa-id-card-o';
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (cipher.subTitle === '') {
|
|
||||||
cipher.subTitle = null;
|
cipher.subTitle = null;
|
||||||
}
|
cipher.icon = 'fa-sticky-note-o';
|
||||||
|
break;
|
||||||
|
case constants.cipherType.card:
|
||||||
|
cipher.subTitle = '';
|
||||||
|
cipher.meta.number = _service.decryptProperty(encryptedCipher.Card.Number, key, true, true);
|
||||||
|
var brand = _service.decryptProperty(encryptedCipher.Card.Brand, key, true, true);
|
||||||
|
if (brand) {
|
||||||
|
cipher.subTitle = brand;
|
||||||
|
}
|
||||||
|
if (cipher.meta.number && cipher.meta.number.length >= 4) {
|
||||||
|
if (cipher.subTitle !== '') {
|
||||||
|
cipher.subTitle += ', ';
|
||||||
|
}
|
||||||
|
cipher.subTitle += ('*' + cipher.meta.number.substr(cipher.meta.number.length - 4));
|
||||||
|
}
|
||||||
|
cipher.icon = 'fa-credit-card';
|
||||||
|
break;
|
||||||
|
case constants.cipherType.identity:
|
||||||
|
var firstName = _service.decryptProperty(encryptedCipher.Identity.FirstName, key, true, true);
|
||||||
|
var lastName = _service.decryptProperty(encryptedCipher.Identity.LastName, key, true, true);
|
||||||
|
cipher.subTitle = '';
|
||||||
|
if (firstName) {
|
||||||
|
cipher.subTitle = firstName;
|
||||||
|
}
|
||||||
|
if (lastName) {
|
||||||
|
if (cipher.subTitle !== '') {
|
||||||
|
cipher.subTitle += ' ';
|
||||||
|
}
|
||||||
|
cipher.subTitle += lastName;
|
||||||
|
}
|
||||||
|
cipher.icon = 'fa-id-card-o';
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cipher.subTitle === '') {
|
||||||
|
cipher.subTitle = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return cipher;
|
return cipher;
|
||||||
@ -389,15 +396,24 @@ angular
|
|||||||
fields: _service.encryptFields(unencryptedCipher.fields, key)
|
fields: _service.encryptFields(unencryptedCipher.fields, key)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var i;
|
||||||
switch (cipher.type) {
|
switch (cipher.type) {
|
||||||
case constants.cipherType.login:
|
case constants.cipherType.login:
|
||||||
var loginData = unencryptedCipher.login;
|
var loginData = unencryptedCipher.login;
|
||||||
cipher.login = {
|
cipher.login = {
|
||||||
uri: encryptProperty(loginData.uri, key),
|
|
||||||
username: encryptProperty(loginData.username, key),
|
username: encryptProperty(loginData.username, key),
|
||||||
password: encryptProperty(loginData.password, key),
|
password: encryptProperty(loginData.password, key),
|
||||||
totp: encryptProperty(loginData.totp, key)
|
totp: encryptProperty(loginData.totp, key)
|
||||||
};
|
};
|
||||||
|
if (loginData.uris && loginData.uris.length) {
|
||||||
|
cipher.login.uris = [];
|
||||||
|
for (i = 0; i < loginData.uris.length; i++) {
|
||||||
|
cipher.login.uris.push({
|
||||||
|
uri: encryptProperty(loginData.uris[i].uri, key),
|
||||||
|
match: loginData.uris[i].match
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case constants.cipherType.secureNote:
|
case constants.cipherType.secureNote:
|
||||||
cipher.secureNote = {
|
cipher.secureNote = {
|
||||||
@ -444,7 +460,7 @@ angular
|
|||||||
|
|
||||||
if (unencryptedCipher.attachments && attachments) {
|
if (unencryptedCipher.attachments && attachments) {
|
||||||
cipher.attachments = {};
|
cipher.attachments = {};
|
||||||
for (var i = 0; i < unencryptedCipher.attachments.length; i++) {
|
for (i = 0; i < unencryptedCipher.attachments.length; i++) {
|
||||||
cipher.attachments[unencryptedCipher.attachments[i].id] =
|
cipher.attachments[unencryptedCipher.attachments[i].id] =
|
||||||
cryptoService.encrypt(unencryptedCipher.attachments[i].fileName, key);
|
cryptoService.encrypt(unencryptedCipher.attachments[i].fileName, key);
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,13 @@
|
|||||||
folderId: selectedFolder ? selectedFolder.id : null,
|
folderId: selectedFolder ? selectedFolder.id : null,
|
||||||
favorite: checkedFavorite === true,
|
favorite: checkedFavorite === true,
|
||||||
type: constants.cipherType.login,
|
type: constants.cipherType.login,
|
||||||
login: {},
|
login: {
|
||||||
|
uris: [{
|
||||||
|
uri: null,
|
||||||
|
match: null,
|
||||||
|
matchValue: null
|
||||||
|
}]
|
||||||
|
},
|
||||||
identity: {},
|
identity: {},
|
||||||
card: {},
|
card: {},
|
||||||
secureNote: {
|
secureNote: {
|
||||||
@ -44,6 +50,42 @@
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
$scope.addUri = function () {
|
||||||
|
if (!$scope.cipher.login) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$scope.cipher.login.uris) {
|
||||||
|
$scope.cipher.login.uris = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
$scope.cipher.login.uris.push({
|
||||||
|
uri: null,
|
||||||
|
match: null,
|
||||||
|
matchValue: null
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
$scope.removeUri = function (uri) {
|
||||||
|
if (!$scope.cipher.login || !$scope.cipher.login.uris) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var index = $scope.cipher.login.uris.indexOf(uri);
|
||||||
|
if (index > -1) {
|
||||||
|
$scope.cipher.login.uris.splice(index, 1);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
$scope.uriMatchChanged = function (uri) {
|
||||||
|
if ((!uri.matchValue && uri.matchValue !== 0) || uri.matchValue === '') {
|
||||||
|
uri.match = null;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
uri.match = parseInt(uri.matchValue);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
$scope.addField = function () {
|
$scope.addField = function () {
|
||||||
if (!$scope.cipher.fields) {
|
if (!$scope.cipher.fields) {
|
||||||
$scope.cipher.fields = [];
|
$scope.cipher.fields = [];
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
$scope.cipher = cipherService.decryptCipher(cipher);
|
$scope.cipher = cipherService.decryptCipher(cipher);
|
||||||
$scope.readOnly = !$scope.cipher.edit;
|
$scope.readOnly = !$scope.cipher.edit;
|
||||||
$scope.useTotp = $scope.useTotp || $scope.cipher.organizationUseTotp;
|
$scope.useTotp = $scope.useTotp || $scope.cipher.organizationUseTotp;
|
||||||
|
setUriMatchValues();
|
||||||
});
|
});
|
||||||
|
|
||||||
$scope.save = function (model) {
|
$scope.save = function (model) {
|
||||||
@ -55,6 +56,42 @@
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
$scope.addUri = function () {
|
||||||
|
if (!$scope.cipher.login) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$scope.cipher.login.uris) {
|
||||||
|
$scope.cipher.login.uris = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
$scope.cipher.login.uris.push({
|
||||||
|
uri: null,
|
||||||
|
match: null,
|
||||||
|
matchValue: null
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
$scope.removeUri = function (uri) {
|
||||||
|
if (!$scope.cipher.login || !$scope.cipher.login.uris) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var index = $scope.cipher.login.uris.indexOf(uri);
|
||||||
|
if (index > -1) {
|
||||||
|
$scope.cipher.login.uris.splice(index, 1);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
$scope.uriMatchChanged = function (uri) {
|
||||||
|
if ((!uri.matchValue && uri.matchValue !== 0) || uri.matchValue === '') {
|
||||||
|
uri.match = null;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
uri.match = parseInt(uri.matchValue);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
$scope.addField = function () {
|
$scope.addField = function () {
|
||||||
if (!$scope.cipher.fields) {
|
if (!$scope.cipher.fields) {
|
||||||
$scope.cipher.fields = [];
|
$scope.cipher.fields = [];
|
||||||
@ -130,4 +167,14 @@
|
|||||||
controller: 'premiumRequiredController'
|
controller: 'premiumRequiredController'
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
function setUriMatchValues() {
|
||||||
|
if ($scope.cipher.login && $scope.cipher.login.uris) {
|
||||||
|
for (var i = 0; i < $scope.cipher.login.uris.length; i++) {
|
||||||
|
$scope.cipher.login.uris[i].matchValue =
|
||||||
|
$scope.cipher.login.uris[i].match || $scope.cipher.login.uris[i].match === 0 ?
|
||||||
|
$scope.cipher.login.uris[i].match.toString() : '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
@ -39,26 +39,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div ng-if="cipher.type === constants.cipherType.login">
|
<div ng-if="cipher.type === constants.cipherType.login">
|
||||||
<div class="form-group" show-errors>
|
|
||||||
<label for="uri">URI</label>
|
|
||||||
<div class="input-group">
|
|
||||||
<input type="text" id="uri" name="Login.Uri" ng-model="cipher.login.uri" class="form-control"
|
|
||||||
placeholder="http://..." ng-readonly="readOnly" api-field />
|
|
||||||
<span class="input-group-btn">
|
|
||||||
<button class="btn btn-default btn-flat" type="button" uib-tooltip="Copy URI"
|
|
||||||
tooltip-placement="left" ngclipboard ngclipboard-error="clipboardError(e)"
|
|
||||||
data-clipboard-target="#uri">
|
|
||||||
<i class="fa fa-clipboard"></i>
|
|
||||||
</button>
|
|
||||||
<a href="{{cipher.login.uri}}" target="_blank" class="btn btn-default btn-flat"
|
|
||||||
uib-tooltip="Go To Website" tooltip-placement="left">
|
|
||||||
<i class="fa fa-share"></i>
|
|
||||||
</a>
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-sm-6">
|
<div class="col-sm-6">
|
||||||
<div class="form-group" show-errors>
|
<div class="form-group" show-errors>
|
||||||
@ -120,6 +101,58 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div ng-repeat="u in cipher.login.uris" ng-if="cipher.login.uris && cipher.login.uris.length">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-sm-7">
|
||||||
|
<div class="form-group" show-errors>
|
||||||
|
<label for="uri{{$index}}">URI {{$index + 1}}</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<input type="text" id="uri{{$index}}" name="Login.Uris[{{$index}}].Uri"
|
||||||
|
ng-model="u.uri" class="form-control"
|
||||||
|
placeholder="http://..." ng-readonly="readOnly" api-field />
|
||||||
|
<span class="input-group-btn">
|
||||||
|
<button class="btn btn-default btn-flat" type="button" uib-tooltip="Copy URI"
|
||||||
|
tooltip-placement="left" ngclipboard ngclipboard-error="clipboardError(e)"
|
||||||
|
data-clipboard-target="#uri{{$index}}">
|
||||||
|
<i class="fa fa-clipboard"></i>
|
||||||
|
</button>
|
||||||
|
<a href="{{u.uri}}" target="_blank" class="btn btn-default btn-flat"
|
||||||
|
uib-tooltip="Go To Website" tooltip-placement="left">
|
||||||
|
<i class="fa fa-share"></i>
|
||||||
|
</a>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-sm-4">
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="uri_match_{{$index}}">Auto-fill Detection</label>
|
||||||
|
<select id="uri_match_{{$index}}" name="Login.Uris[{{$index}}].Match"
|
||||||
|
class="form-control" ng-model="u.matchValue" ng-change="uriMatchChanged(u)">
|
||||||
|
<option value="">Default</option>
|
||||||
|
<option value="0">Base domain</option>
|
||||||
|
<option value="1">Host</option>
|
||||||
|
<option value="2">Starts with</option>
|
||||||
|
<option value="4">Regular Expression</option>
|
||||||
|
<option value="3">Exact</option>
|
||||||
|
<option value="5">Never</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-sm-1">
|
||||||
|
<br class="hidden-xs" />
|
||||||
|
<a href="#" ng-click="removeUri(u)" stop-click>
|
||||||
|
<i class="fa fa-window-close-o fa-lg"></i>
|
||||||
|
<span class="visible-xs-inline">Remove URI</span>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<hr class="visible-xs-block" />
|
||||||
|
</div>
|
||||||
|
<a href="#" ng-click="addUri()" stop-click>
|
||||||
|
<i class="fa fa-plus-circle"></i> New URI
|
||||||
|
</a>
|
||||||
|
<br /><br />
|
||||||
</div>
|
</div>
|
||||||
<div ng-if="cipher.type === constants.cipherType.card">
|
<div ng-if="cipher.type === constants.cipherType.card">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
@ -505,7 +538,6 @@
|
|||||||
<div ng-if="cipher.type === constants.cipherType.secureNote">
|
<div ng-if="cipher.type === constants.cipherType.secureNote">
|
||||||
<!-- Nothing for now -->
|
<!-- Nothing for now -->
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group" show-errors>
|
<div class="form-group" show-errors>
|
||||||
<label for="notes">Notes</label>
|
<label for="notes">Notes</label>
|
||||||
<textarea id="notes" name="Notes" class="form-control" ng-model="cipher.notes" api-field
|
<textarea id="notes" name="Notes" class="form-control" ng-model="cipher.notes" api-field
|
||||||
|
@ -33,24 +33,6 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div ng-if="cipher.type === constants.cipherType.login">
|
<div ng-if="cipher.type === constants.cipherType.login">
|
||||||
<div class="form-group" show-errors>
|
|
||||||
<label for="uri">URI</label>
|
|
||||||
<div class="input-group">
|
|
||||||
<input type="text" id="uri" name="Login.Uri" ng-model="cipher.login.uri" class="form-control"
|
|
||||||
placeholder="http://..." ng-readonly="readOnly" api-field />
|
|
||||||
<span class="input-group-btn">
|
|
||||||
<button class="btn btn-default btn-flat" type="button" uib-tooltip="Copy URI"
|
|
||||||
tooltip-placement="left" ngclipboard ngclipboard-error="clipboardError(e)"
|
|
||||||
data-clipboard-target="#uri">
|
|
||||||
<i class="fa fa-clipboard"></i>
|
|
||||||
</button>
|
|
||||||
<a href="{{cipher.login.uri}}" target="_blank" class="btn btn-default btn-flat"
|
|
||||||
uib-tooltip="Go To Website" tooltip-placement="left">
|
|
||||||
<i class="fa fa-share"></i>
|
|
||||||
</a>
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-sm-6">
|
<div class="col-sm-6">
|
||||||
<div class="form-group" show-errors>
|
<div class="form-group" show-errors>
|
||||||
@ -112,6 +94,60 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div ng-repeat="u in cipher.login.uris" ng-if="cipher.login.uris && cipher.login.uris.length">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-sm-7">
|
||||||
|
<div class="form-group" show-errors>
|
||||||
|
<label for="uri{{$index}}">URI {{$index + 1}}</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<input type="text" id="uri{{$index}}" name="Login.Uris[{{$index}}].Uri"
|
||||||
|
ng-model="u.uri" class="form-control"
|
||||||
|
placeholder="http://..." ng-readonly="readOnly" api-field />
|
||||||
|
<span class="input-group-btn">
|
||||||
|
<button class="btn btn-default btn-flat" type="button" uib-tooltip="Copy URI"
|
||||||
|
tooltip-placement="left" ngclipboard ngclipboard-error="clipboardError(e)"
|
||||||
|
data-clipboard-target="#uri{{$index}}">
|
||||||
|
<i class="fa fa-clipboard"></i>
|
||||||
|
</button>
|
||||||
|
<a href="{{u.uri}}" target="_blank" class="btn btn-default btn-flat"
|
||||||
|
uib-tooltip="Go To Website" tooltip-placement="left">
|
||||||
|
<i class="fa fa-share"></i>
|
||||||
|
</a>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-sm-4">
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="uri_match_{{$index}}">Auto-fill Detection</label>
|
||||||
|
<select id="uri_match_{{$index}}" name="Login.Uris[{{$index}}].Match" ng-disabled="readOnly"
|
||||||
|
class="form-control" ng-model="u.matchValue" ng-change="uriMatchChanged(u)">
|
||||||
|
<option value="">Default</option>
|
||||||
|
<option value="0">Base domain</option>
|
||||||
|
<option value="1">Host</option>
|
||||||
|
<option value="2">Starts with</option>
|
||||||
|
<option value="4">Regular Expression</option>
|
||||||
|
<option value="3">Exact</option>
|
||||||
|
<option value="5">Never</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-sm-1" ng-if="!readOnly">
|
||||||
|
<br class="hidden-xs" />
|
||||||
|
<a href="#" ng-click="removeUri(u)" stop-click>
|
||||||
|
<i class="fa fa-window-close-o fa-lg"></i>
|
||||||
|
<span class="visible-xs-inline">Remove URI</span>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<hr class="visible-xs-block" />
|
||||||
|
</div>
|
||||||
|
<div ng-if="!readOnly">
|
||||||
|
<a href="#" ng-click="addUri()" stop-click>
|
||||||
|
<i class="fa fa-plus-circle"></i> New URI
|
||||||
|
</a>
|
||||||
|
<br /><br />
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div ng-if="cipher.type === constants.cipherType.card">
|
<div ng-if="cipher.type === constants.cipherType.card">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
@ -552,9 +588,9 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-sm-1">
|
<div class="col-sm-1" ng-if="!readOnly">
|
||||||
<br class="hidden-xs" />
|
<br class="hidden-xs" />
|
||||||
<a href="#" ng-click="removeField(field)" stop-click ng-if="!readOnly">
|
<a href="#" ng-click="removeField(field)" stop-click>
|
||||||
<i class="fa fa-window-close-o fa-lg"></i>
|
<i class="fa fa-window-close-o fa-lg"></i>
|
||||||
<span class="visible-xs-inline">Remove Custom Field</span>
|
<span class="visible-xs-inline">Remove Custom Field</span>
|
||||||
</a>
|
</a>
|
||||||
|
Loading…
Reference in New Issue
Block a user