support for cipher login uris and match detection
This commit is contained in:
parent
ced108d1a6
commit
c27f5836bf
2
jslib
2
jslib
|
@ -1 +1 @@
|
|||
Subproject commit e3b3e444dbff7e4541fa5367ee26bc7ed4d73b26
|
||||
Subproject commit ad4c81ed844f42e45467cd4467d993d30b1f8ce0
|
|
@ -129,7 +129,7 @@ export default class MainBackground {
|
|||
this.userService = new UserService(this.tokenService, this.storageService);
|
||||
this.settingsService = new SettingsService(this.userService, this.storageService);
|
||||
this.cipherService = new CipherService(this.cryptoService, this.userService, this.settingsService,
|
||||
this.apiService, this.storageService, this.i18n2Service);
|
||||
this.apiService, this.storageService, this.i18n2Service, this.platformUtilsService, this.utilsService);
|
||||
this.folderService = new FolderService(this.cryptoService, this.userService,
|
||||
() => this.i18nService.noneFolder, this.apiService, this.storageService, this.i18n2Service);
|
||||
this.collectionService = new CollectionService(this.cryptoService, this.userService, this.storageService,
|
||||
|
@ -378,17 +378,12 @@ export default class MainBackground {
|
|||
return;
|
||||
}
|
||||
|
||||
const tabDomain = this.platformUtilsService.getDomain(url);
|
||||
if (tabDomain == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.actionSetBadgeBackgroundColor(chrome.browserAction);
|
||||
this.actionSetBadgeBackgroundColor(this.sidebarAction);
|
||||
|
||||
this.menuOptionsLoaded = [];
|
||||
try {
|
||||
const ciphers = await this.cipherService.getAllDecryptedForDomain(tabDomain);
|
||||
const ciphers = await this.cipherService.getAllDecryptedForUrl(url);
|
||||
ciphers.sort(this.cipherService.sortCiphersByLastUsedThenName);
|
||||
|
||||
if (contextMenuEnabled) {
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import { CipherType } from 'jslib/enums';
|
||||
|
||||
import { CipherView } from 'jslib/models/view/cipherView';
|
||||
import { LoginUriView } from 'jslib/models/view/loginUriView';
|
||||
import { LoginView } from 'jslib/models/view/loginView';
|
||||
|
||||
import { ConstantsService } from 'jslib/services/constants.service';
|
||||
|
@ -181,7 +182,9 @@ export default class RuntimeBackground {
|
|||
this.main.loginsToAdd.splice(i, 1);
|
||||
|
||||
const loginModel = new LoginView();
|
||||
loginModel.uri = loginInfo.uri;
|
||||
const loginUri = new LoginUriView();
|
||||
loginUri.uri = loginInfo.uri;
|
||||
loginModel.uris = [loginUri];
|
||||
loginModel.username = loginInfo.username;
|
||||
loginModel.password = loginInfo.password;
|
||||
const model = new CipherView();
|
||||
|
@ -225,8 +228,7 @@ export default class RuntimeBackground {
|
|||
return;
|
||||
}
|
||||
|
||||
const ciphers = await this.cipherService.getAllDecryptedForDomain(loginDomain);
|
||||
|
||||
const ciphers = await this.cipherService.getAllDecryptedForUrl(loginInfo.url);
|
||||
let match = false;
|
||||
for (let i = 0; i < ciphers.length; i++) {
|
||||
if (ciphers[i].login.username === loginInfo.username) {
|
||||
|
|
|
@ -27,22 +27,14 @@ export default class WebRequestBackground {
|
|||
return;
|
||||
}
|
||||
|
||||
const domain = this.platformUtilsService.getDomain(details.url);
|
||||
if (domain == null) {
|
||||
if (callback) {
|
||||
callback();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
this.pendingAuthRequests.push(details.requestId);
|
||||
|
||||
if (this.isFirefox) {
|
||||
return new Promise(async (resolve, reject) => {
|
||||
await this.resolveAuthCredentials(domain, resolve, reject);
|
||||
await this.resolveAuthCredentials(details.url, resolve, reject);
|
||||
});
|
||||
} else {
|
||||
await this.resolveAuthCredentials(domain, callback, callback);
|
||||
await this.resolveAuthCredentials(details.url, callback, callback);
|
||||
}
|
||||
}, { urls: ['http://*/*', 'https://*/*'] }, [this.isFirefox ? 'blocking' : 'asyncBlocking']);
|
||||
|
||||
|
@ -54,7 +46,7 @@ export default class WebRequestBackground {
|
|||
|
||||
private async resolveAuthCredentials(domain: string, success: Function, error: Function) {
|
||||
try {
|
||||
const ciphers = await this.cipherService.getAllDecryptedForDomain(domain);
|
||||
const ciphers = await this.cipherService.getAllDecryptedForUrl(domain);
|
||||
if (ciphers == null || ciphers.length !== 1) {
|
||||
error();
|
||||
return;
|
||||
|
|
|
@ -133,7 +133,7 @@ export class CurrentController {
|
|||
CipherType.Identity,
|
||||
];
|
||||
|
||||
const ciphers = await this.cipherService.getAllDecryptedForDomain(this.domain, otherTypes);
|
||||
const ciphers = await this.cipherService.getAllDecryptedForUrl(this.url, otherTypes);
|
||||
const loginCiphers: any = [];
|
||||
const cardCiphers: any = [];
|
||||
const identityCiphers: any = [];
|
||||
|
|
|
@ -216,12 +216,7 @@ export default class AutofillService implements AutofillServiceInterface {
|
|||
return;
|
||||
}
|
||||
|
||||
const tabDomain = this.platformUtilsService.getDomain(tab.url);
|
||||
if (tabDomain == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
const lastUsedCipher = await this.cipherService.getLastUsedForDomain(tabDomain);
|
||||
const lastUsedCipher = await this.cipherService.getLastUsedForUrl(tab.url);
|
||||
if (!lastUsedCipher) {
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue