mirror of
https://github.com/bitwarden/browser
synced 2025-12-17 08:43:33 +00:00
edge hates for of loops
This commit is contained in:
@@ -71,18 +71,18 @@ class Cipher extends Domain {
|
|||||||
|
|
||||||
if (obj.attachments != null) {
|
if (obj.attachments != null) {
|
||||||
this.attachments = [];
|
this.attachments = [];
|
||||||
for (const attachment of obj.attachments) {
|
obj.attachments.forEach((attachment) => {
|
||||||
this.attachments.push(new Attachment(attachment, alreadyEncrypted));
|
this.attachments.push(new Attachment(attachment, alreadyEncrypted));
|
||||||
}
|
});
|
||||||
} else {
|
} else {
|
||||||
this.attachments = null;
|
this.attachments = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (obj.fields != null) {
|
if (obj.fields != null) {
|
||||||
this.fields = [];
|
this.fields = [];
|
||||||
for (const field of obj.fields) {
|
obj.fields.forEach((field) => {
|
||||||
this.fields.push(new Field(field, alreadyEncrypted));
|
this.fields.push(new Field(field, alreadyEncrypted));
|
||||||
}
|
});
|
||||||
} else {
|
} else {
|
||||||
this.fields = null;
|
this.fields = null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -74,13 +74,13 @@ class CipherRequest {
|
|||||||
|
|
||||||
if (cipher.fields) {
|
if (cipher.fields) {
|
||||||
this.fields = [];
|
this.fields = [];
|
||||||
for (const field of cipher.fields) {
|
cipher.fields.forEach((field: any) => {
|
||||||
this.fields.push({
|
this.fields.push({
|
||||||
type: field.type,
|
type: field.type,
|
||||||
name: field.name ? field.name.encryptedString : null,
|
name: field.name ? field.name.encryptedString : null,
|
||||||
value: field.value ? field.value.encryptedString : null,
|
value: field.value ? field.value.encryptedString : null,
|
||||||
});
|
});
|
||||||
}
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,9 +25,9 @@ class CipherResponse {
|
|||||||
|
|
||||||
if (response.Attachments != null) {
|
if (response.Attachments != null) {
|
||||||
this.attachments = [];
|
this.attachments = [];
|
||||||
for (const attachment of response.Attachments) {
|
response.Attachments.forEach((attachment: any) => {
|
||||||
this.attachments.push(new AttachmentResponse(attachment));
|
this.attachments.push(new AttachmentResponse(attachment));
|
||||||
}
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
import { CipherType } from '../../../enums/cipherType.enum';
|
||||||
|
|
||||||
import { UtilsService } from '../../../services/abstractions/utils.service';
|
import { UtilsService } from '../../../services/abstractions/utils.service';
|
||||||
import * as template from './current.component.html';
|
import * as template from './current.component.html';
|
||||||
|
|
||||||
@@ -16,9 +18,7 @@ class CurrentController {
|
|||||||
|
|
||||||
constructor($scope: any, private cipherService: any, private utilsService: UtilsService, private toastr: any,
|
constructor($scope: any, private cipherService: any, private utilsService: UtilsService, private toastr: any,
|
||||||
private $window: any, private $state: any, private $timeout: any, private autofillService: any,
|
private $window: any, private $state: any, private $timeout: any, private autofillService: any,
|
||||||
private $analytics: any, private i18nService: any, private constantsService: any,
|
private $analytics: any, private i18nService: any, private $filter: any) {
|
||||||
private $filter: any) {
|
|
||||||
|
|
||||||
this.i18n = i18nService;
|
this.i18n = i18nService;
|
||||||
this.inSidebar = utilsService.inSidebar($window);
|
this.inSidebar = utilsService.inSidebar($window);
|
||||||
this.disableSearch = utilsService.isEdge();
|
this.disableSearch = utilsService.isEdge();
|
||||||
@@ -67,13 +67,11 @@ class CurrentController {
|
|||||||
this.toastr.error(this.i18nService.autofillError);
|
this.toastr.error(this.i18nService.autofillError);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.autofillService
|
this.autofillService.doAutoFill({
|
||||||
.doAutoFill({
|
|
||||||
cipher,
|
cipher,
|
||||||
pageDetails: this.pageDetails,
|
pageDetails: this.pageDetails,
|
||||||
fromBackground: false,
|
fromBackground: false,
|
||||||
})
|
}).then((totpCode: string) => {
|
||||||
.then((totpCode: string) => {
|
|
||||||
this.$analytics.eventTrack('Autofilled');
|
this.$analytics.eventTrack('Autofilled');
|
||||||
if (totpCode && this.utilsService.isFirefox()) {
|
if (totpCode && this.utilsService.isFirefox()) {
|
||||||
this.utilsService.copyToClipboard(totpCode, document);
|
this.utilsService.copyToClipboard(totpCode, document);
|
||||||
@@ -81,8 +79,7 @@ class CurrentController {
|
|||||||
if (this.utilsService.inPopup(this.$window)) {
|
if (this.utilsService.inPopup(this.$window)) {
|
||||||
this.$window.close();
|
this.$window.close();
|
||||||
}
|
}
|
||||||
})
|
}).catch(() => {
|
||||||
.catch(() => {
|
|
||||||
this.$analytics.eventTrack('Autofilled Error');
|
this.$analytics.eventTrack('Autofilled Error');
|
||||||
this.toastr.error(this.i18nService.autofillError);
|
this.toastr.error(this.i18nService.autofillError);
|
||||||
});
|
});
|
||||||
@@ -116,21 +113,21 @@ class CurrentController {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const otherTypes = [
|
const otherTypes = [
|
||||||
this.constantsService.cipherType.card,
|
CipherType.Card,
|
||||||
this.constantsService.cipherType.identity,
|
CipherType.Identity,
|
||||||
];
|
];
|
||||||
|
|
||||||
this.cipherService.getAllDecryptedForDomain(this.domain, otherTypes).then((ciphers: any) => {
|
this.cipherService.getAllDecryptedForDomain(this.domain, otherTypes).then((ciphers: any[]) => {
|
||||||
const loginCiphers: any = [];
|
const loginCiphers: any = [];
|
||||||
const otherCiphers: any = [];
|
const otherCiphers: any = [];
|
||||||
|
|
||||||
for (const cipher of ciphers) {
|
ciphers.forEach((cipher) => {
|
||||||
if (cipher.type === this.constantsService.cipherType.login) {
|
if (cipher.type === CipherType.Login) {
|
||||||
loginCiphers.push(cipher);
|
loginCiphers.push(cipher);
|
||||||
} else {
|
} else {
|
||||||
otherCiphers.push(cipher);
|
otherCiphers.push(cipher);
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
|
|
||||||
this.$timeout(() => {
|
this.$timeout(() => {
|
||||||
this.loginCiphers = this.$filter('orderBy')(
|
this.loginCiphers = this.$filter('orderBy')(
|
||||||
|
|||||||
@@ -13,11 +13,11 @@ class ValidationService {
|
|||||||
} else if (!data.validationErrors) {
|
} else if (!data.validationErrors) {
|
||||||
errors.push(data.message ? data.message : defaultErrorMessage);
|
errors.push(data.message ? data.message : defaultErrorMessage);
|
||||||
} else {
|
} else {
|
||||||
for (const error of data.validationErrors) {
|
data.validationErrors.forEach((error: any) => {
|
||||||
error.forEach((item: string) => {
|
error.forEach((item: string) => {
|
||||||
errors.push(item);
|
errors.push(item);
|
||||||
});
|
});
|
||||||
}
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (errors.length) {
|
if (errors.length) {
|
||||||
|
|||||||
Reference in New Issue
Block a user