1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-17 00:33:44 +00:00

finish autofill from view, other misc cleanup (#1368)

* finish autofill from view, other misc cleanup

* compare hostnames for authResult
This commit is contained in:
Kyle Spearrin
2020-08-24 10:17:15 -04:00
committed by GitHub
parent d4d5ccc4a4
commit b7c2c76230
12 changed files with 150 additions and 140 deletions

View File

@@ -38,8 +38,7 @@ export default class RuntimeBackground {
private storageService: StorageService, private i18nService: I18nService,
private analytics: Analytics, private notificationsService: NotificationsService,
private systemService: SystemService, private vaultTimeoutService: VaultTimeoutService,
private syncService: SyncService, private authService: AuthService, private stateService: StateService,
private environmentService: EnvironmentService, private popupUtilsService : PopupUtilsService) {
private environmentService: EnvironmentService) {
this.isSafari = this.platformUtilsService.isSafari();
this.runtime = this.isSafari ? {} : chrome.runtime;
@@ -165,25 +164,21 @@ export default class RuntimeBackground {
}
break;
case 'authResult':
var vaultUrl = this.environmentService.webVaultUrl;
if(!vaultUrl) {
vaultUrl = 'https://vault.bitwarden.com';
}
let vaultUrl = this.environmentService.webVaultUrl;
if (vaultUrl == null) {
vaultUrl = 'https://vault.bitwarden.com';
}
if(!msg.referrer) {
return;
}
if(!vaultUrl.includes(msg.referrer)) {
return;
}
try {
chrome.tabs.create({
url: 'popup/index.html?uilocation=popout#/sso?code=' + msg.code + '&state=' + msg.state
});
}
catch { }
if (msg.referrer == null || Utils.getHostname(vaultUrl) !== msg.referrer) {
return;
}
try {
chrome.tabs.create({
url: 'popup/index.html?uilocation=popout#/sso?code=' + msg.code + '&state=' + msg.state
});
}
catch { }
break;
default:
break;