user canAccessPremium checks
This commit is contained in:
parent
e4cac73174
commit
2bb3d27408
2
jslib
2
jslib
|
@ -1 +1 @@
|
||||||
Subproject commit 45da8aa9eb4dd7e12c9fa67ed09189bc4d5ed2f1
|
Subproject commit 81c21418ec965221b4d322008f9da0ab7b9037d0
|
|
@ -155,8 +155,7 @@ export default class MainBackground {
|
||||||
this.storageService, this.messagingService, async (expired: boolean) => await this.logout(expired));
|
this.storageService, this.messagingService, async (expired: boolean) => await this.logout(expired));
|
||||||
this.passwordGenerationService = new PasswordGenerationService(this.cryptoService, this.storageService);
|
this.passwordGenerationService = new PasswordGenerationService(this.cryptoService, this.storageService);
|
||||||
this.totpService = new TotpService(this.storageService, cryptoFunctionService);
|
this.totpService = new TotpService(this.storageService, cryptoFunctionService);
|
||||||
this.autofillService = new AutofillService(this.cipherService, this.tokenService,
|
this.autofillService = new AutofillService(this.cipherService, this.userService, this.totpService);
|
||||||
this.totpService);
|
|
||||||
this.containerService = new ContainerService(this.cryptoService, this.platformUtilsService);
|
this.containerService = new ContainerService(this.cryptoService, this.platformUtilsService);
|
||||||
this.auditService = new AuditService(cryptoFunctionService, this.apiService);
|
this.auditService = new AuditService(cryptoFunctionService, this.apiService);
|
||||||
this.exportService = new ExportService(this.folderService, this.cipherService, this.apiService);
|
this.exportService = new ExportService(this.folderService, this.cipherService, this.apiService);
|
||||||
|
|
|
@ -19,6 +19,7 @@ import { I18nService } from 'jslib/abstractions/i18n.service';
|
||||||
import { PlatformUtilsService } from 'jslib/abstractions/platformUtils.service';
|
import { PlatformUtilsService } from 'jslib/abstractions/platformUtils.service';
|
||||||
import { TokenService } from 'jslib/abstractions/token.service';
|
import { TokenService } from 'jslib/abstractions/token.service';
|
||||||
import { TotpService } from 'jslib/abstractions/totp.service';
|
import { TotpService } from 'jslib/abstractions/totp.service';
|
||||||
|
import { UserService } from 'jslib/abstractions/user.service';
|
||||||
|
|
||||||
import { BroadcasterService } from 'jslib/angular/services/broadcaster.service';
|
import { BroadcasterService } from 'jslib/angular/services/broadcaster.service';
|
||||||
|
|
||||||
|
@ -38,9 +39,9 @@ export class ViewComponent extends BaseViewComponent {
|
||||||
auditService: AuditService, private route: ActivatedRoute,
|
auditService: AuditService, private route: ActivatedRoute,
|
||||||
private router: Router, private location: Location,
|
private router: Router, private location: Location,
|
||||||
broadcasterService: BroadcasterService, ngZone: NgZone,
|
broadcasterService: BroadcasterService, ngZone: NgZone,
|
||||||
changeDetectorRef: ChangeDetectorRef) {
|
changeDetectorRef: ChangeDetectorRef, userService: UserService) {
|
||||||
super(cipherService, totpService, tokenService, toasterService, cryptoService, platformUtilsService,
|
super(cipherService, totpService, tokenService, toasterService, cryptoService, platformUtilsService,
|
||||||
i18nService, analytics, auditService, window, broadcasterService, ngZone, changeDetectorRef);
|
i18nService, analytics, auditService, window, broadcasterService, ngZone, changeDetectorRef, userService);
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
|
|
|
@ -13,8 +13,8 @@ import { AutofillService as AutofillServiceInterface } from './abstractions/auto
|
||||||
|
|
||||||
import {
|
import {
|
||||||
CipherService,
|
CipherService,
|
||||||
TokenService,
|
|
||||||
TotpService,
|
TotpService,
|
||||||
|
UserService,
|
||||||
} from 'jslib/abstractions';
|
} from 'jslib/abstractions';
|
||||||
|
|
||||||
const CardAttributes: string[] = ['autoCompleteType', 'data-stripe', 'htmlName', 'htmlID', 'label-tag',
|
const CardAttributes: string[] = ['autoCompleteType', 'data-stripe', 'htmlName', 'htmlID', 'label-tag',
|
||||||
|
@ -103,7 +103,7 @@ var IsoProvinces: { [id: string]: string; } = {
|
||||||
/* tslint:enable */
|
/* tslint:enable */
|
||||||
|
|
||||||
export default class AutofillService implements AutofillServiceInterface {
|
export default class AutofillService implements AutofillServiceInterface {
|
||||||
constructor(private cipherService: CipherService, private tokenService: TokenService,
|
constructor(private cipherService: CipherService, private userService: UserService,
|
||||||
private totpService: TotpService) { }
|
private totpService: TotpService) { }
|
||||||
|
|
||||||
getFormsWithPasswordFields(pageDetails: AutofillPageDetails): any[] {
|
getFormsWithPasswordFields(pageDetails: AutofillPageDetails): any[] {
|
||||||
|
@ -145,6 +145,7 @@ export default class AutofillService implements AutofillServiceInterface {
|
||||||
throw new Error('Nothing to auto-fill.');
|
throw new Error('Nothing to auto-fill.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const canAccessPremium = await this.userService.canAccessPremium();
|
||||||
let didAutofill = false;
|
let didAutofill = false;
|
||||||
options.pageDetails.forEach((pd: any) => {
|
options.pageDetails.forEach((pd: any) => {
|
||||||
// make sure we're still on correct tab
|
// make sure we're still on correct tab
|
||||||
|
@ -174,7 +175,7 @@ export default class AutofillService implements AutofillServiceInterface {
|
||||||
}, { frameId: pd.frameId });
|
}, { frameId: pd.frameId });
|
||||||
|
|
||||||
if (options.cipher.type !== CipherType.Login || totpPromise || options.skipTotp ||
|
if (options.cipher.type !== CipherType.Login || totpPromise || options.skipTotp ||
|
||||||
!options.cipher.login.totp || !this.tokenService.getPremium()) {
|
!options.cipher.login.totp || !canAccessPremium) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue