1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-12 14:23:32 +00:00

user canAccessPremium checks

This commit is contained in:
Kyle Spearrin
2018-08-28 23:17:39 -04:00
parent e4cac73174
commit 2bb3d27408
4 changed files with 9 additions and 8 deletions

2
jslib

Submodule jslib updated: 45da8aa9eb...81c21418ec

View File

@@ -155,8 +155,7 @@ export default class MainBackground {
this.storageService, this.messagingService, async (expired: boolean) => await this.logout(expired));
this.passwordGenerationService = new PasswordGenerationService(this.cryptoService, this.storageService);
this.totpService = new TotpService(this.storageService, cryptoFunctionService);
this.autofillService = new AutofillService(this.cipherService, this.tokenService,
this.totpService);
this.autofillService = new AutofillService(this.cipherService, this.userService, this.totpService);
this.containerService = new ContainerService(this.cryptoService, this.platformUtilsService);
this.auditService = new AuditService(cryptoFunctionService, this.apiService);
this.exportService = new ExportService(this.folderService, this.cipherService, this.apiService);

View File

@@ -19,6 +19,7 @@ import { I18nService } from 'jslib/abstractions/i18n.service';
import { PlatformUtilsService } from 'jslib/abstractions/platformUtils.service';
import { TokenService } from 'jslib/abstractions/token.service';
import { TotpService } from 'jslib/abstractions/totp.service';
import { UserService } from 'jslib/abstractions/user.service';
import { BroadcasterService } from 'jslib/angular/services/broadcaster.service';
@@ -38,9 +39,9 @@ export class ViewComponent extends BaseViewComponent {
auditService: AuditService, private route: ActivatedRoute,
private router: Router, private location: Location,
broadcasterService: BroadcasterService, ngZone: NgZone,
changeDetectorRef: ChangeDetectorRef) {
changeDetectorRef: ChangeDetectorRef, userService: UserService) {
super(cipherService, totpService, tokenService, toasterService, cryptoService, platformUtilsService,
i18nService, analytics, auditService, window, broadcasterService, ngZone, changeDetectorRef);
i18nService, analytics, auditService, window, broadcasterService, ngZone, changeDetectorRef, userService);
}
ngOnInit() {

View File

@@ -13,8 +13,8 @@ import { AutofillService as AutofillServiceInterface } from './abstractions/auto
import {
CipherService,
TokenService,
TotpService,
UserService,
} from 'jslib/abstractions';
const CardAttributes: string[] = ['autoCompleteType', 'data-stripe', 'htmlName', 'htmlID', 'label-tag',
@@ -103,7 +103,7 @@ var IsoProvinces: { [id: string]: string; } = {
/* tslint:enable */
export default class AutofillService implements AutofillServiceInterface {
constructor(private cipherService: CipherService, private tokenService: TokenService,
constructor(private cipherService: CipherService, private userService: UserService,
private totpService: TotpService) { }
getFormsWithPasswordFields(pageDetails: AutofillPageDetails): any[] {
@@ -145,6 +145,7 @@ export default class AutofillService implements AutofillServiceInterface {
throw new Error('Nothing to auto-fill.');
}
const canAccessPremium = await this.userService.canAccessPremium();
let didAutofill = false;
options.pageDetails.forEach((pd: any) => {
// make sure we're still on correct tab
@@ -174,7 +175,7 @@ export default class AutofillService implements AutofillServiceInterface {
}, { frameId: pd.frameId });
if (options.cipher.type !== CipherType.Login || totpPromise || options.skipTotp ||
!options.cipher.login.totp || !this.tokenService.getPremium()) {
!options.cipher.login.totp || !canAccessPremium) {
return;
}