mirror of
https://github.com/bitwarden/browser.git
synced 2025-03-11 13:30:39 +01:00
Implemented feedback
This commit is contained in:
parent
2d56510f0e
commit
3b560fca22
@ -4,7 +4,6 @@ import { CipherView } from 'jslib/models/view/cipherView';
|
|||||||
import { LoginUriView } from 'jslib/models/view/loginUriView';
|
import { LoginUriView } from 'jslib/models/view/loginUriView';
|
||||||
import { LoginView } from 'jslib/models/view/loginView';
|
import { LoginView } from 'jslib/models/view/loginView';
|
||||||
|
|
||||||
import { AuthResult } from 'jslib/models/domain/authResult';
|
|
||||||
import { AuthService } from 'jslib/abstractions/auth.service';
|
import { AuthService } from 'jslib/abstractions/auth.service';
|
||||||
import { AutofillService } from '../services/abstractions/autofill.service';
|
import { AutofillService } from '../services/abstractions/autofill.service';
|
||||||
import BrowserPlatformUtilsService from '../services/browserPlatformUtils.service';
|
import BrowserPlatformUtilsService from '../services/browserPlatformUtils.service';
|
||||||
@ -50,30 +49,6 @@ export default class RuntimeBackground {
|
|||||||
this.onInstalledReason = details.reason;
|
this.onInstalledReason = details.reason;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
chrome.runtime.onMessage.addListener(
|
|
||||||
(request: any) => {
|
|
||||||
|
|
||||||
var vaultUrl = environmentService.webVaultUrl;
|
|
||||||
if(!vaultUrl) {
|
|
||||||
vaultUrl = 'https://vault.bitwarden.com';
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!request.referrer) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!vaultUrl.includes(request.referrer)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (request.type == "AUTH_RESULT") {
|
|
||||||
try {
|
|
||||||
popupUtilsService.ProcessSso(request.code, request.state);
|
|
||||||
}
|
|
||||||
catch (error) { }
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async init() {
|
async init() {
|
||||||
@ -189,6 +164,27 @@ export default class RuntimeBackground {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case 'authResult':
|
||||||
|
var vaultUrl = this.environmentService.webVaultUrl;
|
||||||
|
if(!vaultUrl) {
|
||||||
|
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 { }
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -2,9 +2,9 @@ window.addEventListener("message", function(event) {
|
|||||||
if (event.source != window)
|
if (event.source != window)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (event.data.type && (event.data.type == "AUTH_RESULT")) {
|
if (event.data.command && (event.data.command == "authResult")) {
|
||||||
chrome.runtime.sendMessage({
|
chrome.runtime.sendMessage({
|
||||||
type: event.data.type,
|
command: event.data.command,
|
||||||
code: event.data.code,
|
code: event.data.code,
|
||||||
state: event.data.state,
|
state: event.data.state,
|
||||||
referrer: event.source.location.hostname
|
referrer: event.source.location.hostname
|
||||||
|
@ -9,7 +9,6 @@ import { ApiService } from 'jslib/abstractions/api.service';
|
|||||||
import { AuthService } from 'jslib/abstractions/auth.service';
|
import { AuthService } from 'jslib/abstractions/auth.service';
|
||||||
import BrowserPlatformUtilsService from '../../services/browserPlatformUtils.service';
|
import BrowserPlatformUtilsService from '../../services/browserPlatformUtils.service';
|
||||||
import { CryptoFunctionService } from 'jslib/abstractions/cryptoFunction.service';
|
import { CryptoFunctionService } from 'jslib/abstractions/cryptoFunction.service';
|
||||||
import { ConstantsService } from 'jslib/services/constants.service';
|
|
||||||
import { EnvironmentService } from 'jslib/abstractions/environment.service';
|
import { EnvironmentService } from 'jslib/abstractions/environment.service';
|
||||||
import { I18nService } from 'jslib/abstractions/i18n.service';
|
import { I18nService } from 'jslib/abstractions/i18n.service';
|
||||||
import { PasswordGenerationService } from 'jslib/abstractions/passwordGeneration.service';
|
import { PasswordGenerationService } from 'jslib/abstractions/passwordGeneration.service';
|
||||||
@ -30,8 +29,7 @@ export class SsoComponent extends BaseSsoComponent {
|
|||||||
storageService: StorageService, stateService: StateService,
|
storageService: StorageService, stateService: StateService,
|
||||||
platformUtilsService: PlatformUtilsService, apiService: ApiService,
|
platformUtilsService: PlatformUtilsService, apiService: ApiService,
|
||||||
cryptoFunctionService: CryptoFunctionService, passwordGenerationService: PasswordGenerationService,
|
cryptoFunctionService: CryptoFunctionService, passwordGenerationService: PasswordGenerationService,
|
||||||
syncService: SyncService, private browserPlatformUtilsService: BrowserPlatformUtilsService,
|
syncService: SyncService, private environmentService: EnvironmentService ) {
|
||||||
private environmentService: EnvironmentService ) {
|
|
||||||
super(authService, router, i18nService, route, storageService, stateService, platformUtilsService,
|
super(authService, router, i18nService, route, storageService, stateService, platformUtilsService,
|
||||||
apiService, cryptoFunctionService, passwordGenerationService);
|
apiService, cryptoFunctionService, passwordGenerationService);
|
||||||
|
|
||||||
@ -44,17 +42,7 @@ export class SsoComponent extends BaseSsoComponent {
|
|||||||
this.clientId = 'browser';
|
this.clientId = 'browser';
|
||||||
|
|
||||||
super.onSuccessfulLogin = () => {
|
super.onSuccessfulLogin = () => {
|
||||||
var sidebarName : string = this.browserPlatformUtilsService.sidebarViewName();
|
|
||||||
var sidebarWindows = chrome.extension.getViews({ type: sidebarName });
|
|
||||||
if(sidebarWindows && sidebarWindows.length > 0) {
|
|
||||||
sidebarWindows[0].location.reload();
|
|
||||||
}
|
|
||||||
|
|
||||||
return syncService.fullSync(true);
|
return syncService.fullSync(true);
|
||||||
};
|
};
|
||||||
|
|
||||||
super.onSuccessfulLoginTwoFactorNavigate = () => {
|
|
||||||
return router.navigate(['2fa']);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -78,12 +78,4 @@ export class PopupUtilsService {
|
|||||||
// Safari can't open popup in full page tab :(
|
// Safari can't open popup in full page tab :(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ProcessSso(code: string, state: string)
|
|
||||||
{
|
|
||||||
// Redirect to SSO token validation.
|
|
||||||
chrome.tabs.create({
|
|
||||||
url: 'popup/index.html?uilocation=popout#/sso?code=' + code + '&state=' + state
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user