re-set favicon state after unlock/login

This commit is contained in:
Kyle Spearrin 2019-07-02 08:13:33 -04:00
parent 53bf68de49
commit 2aa71f98a1
3 changed files with 18 additions and 4 deletions

View File

@ -7,6 +7,7 @@ import { I18nService } from '../../abstractions/i18n.service';
import { LockService } from '../../abstractions/lock.service';
import { MessagingService } from '../../abstractions/messaging.service';
import { PlatformUtilsService } from '../../abstractions/platformUtils.service';
import { StateService } from '../../abstractions/state.service';
import { StorageService } from '../../abstractions/storage.service';
import { UserService } from '../../abstractions/user.service';
@ -35,7 +36,7 @@ export class LockComponent implements OnInit {
protected platformUtilsService: PlatformUtilsService, protected messagingService: MessagingService,
protected userService: UserService, protected cryptoService: CryptoService,
protected storageService: StorageService, protected lockService: LockService,
protected environmentService: EnvironmentService) { }
protected environmentService: EnvironmentService, protected stateService: StateService) { }
async ngOnInit() {
this.pinSet = await this.lockService.isPinLockSet();
@ -126,7 +127,9 @@ export class LockComponent implements OnInit {
this.doContinue();
}
private doContinue() {
private async doContinue() {
const disableFavicon = await this.storageService.get<boolean>(ConstantsService.disableFaviconKey);
await this.stateService.save(ConstantsService.disableFaviconKey, !!disableFavicon);
this.messagingService.send('unlocked');
if (this.onSuccessfulSubmit != null) {
this.onSuccessfulSubmit();

View File

@ -9,8 +9,11 @@ import { AuthResult } from '../../models/domain/authResult';
import { AuthService } from '../../abstractions/auth.service';
import { I18nService } from '../../abstractions/i18n.service';
import { PlatformUtilsService } from '../../abstractions/platformUtils.service';
import { StateService } from '../../abstractions/state.service';
import { StorageService } from '../../abstractions/storage.service';
import { ConstantsService } from '../../services/constants.service';
import { Utils } from '../../misc/utils';
const Keys = {
@ -34,7 +37,7 @@ export class LoginComponent implements OnInit {
constructor(protected authService: AuthService, protected router: Router,
protected platformUtilsService: PlatformUtilsService, protected i18nService: I18nService,
private storageService: StorageService) { }
private storageService: StorageService, private stateService: StorageService) { }
async ngOnInit() {
if (this.email == null || this.email === '') {
@ -86,6 +89,8 @@ export class LoginComponent implements OnInit {
this.router.navigate([this.twoFactorRoute]);
}
} else {
const disableFavicon = await this.storageService.get<boolean>(ConstantsService.disableFaviconKey);
await this.stateService.save(ConstantsService.disableFaviconKey, !!disableFavicon);
if (this.onSuccessfulLogin != null) {
this.onSuccessfulLogin();
}

View File

@ -14,8 +14,11 @@ import { AuthService } from '../../abstractions/auth.service';
import { EnvironmentService } from '../../abstractions/environment.service';
import { I18nService } from '../../abstractions/i18n.service';
import { PlatformUtilsService } from '../../abstractions/platformUtils.service';
import { StateService } from '../../abstractions/state.service';
import { StorageService } from '../../abstractions/storage.service';
import { TwoFactorProviders } from '../../services/auth.service';
import { ConstantsService } from '../../services/constants.service';
import * as DuoWebSDK from 'duo_web_sdk';
import { U2f } from '../../misc/u2f';
@ -42,7 +45,8 @@ export class TwoFactorComponent implements OnInit, OnDestroy {
constructor(protected authService: AuthService, protected router: Router,
protected i18nService: I18nService, protected apiService: ApiService,
protected platformUtilsService: PlatformUtilsService, protected win: Window,
protected environmentService: EnvironmentService) {
protected environmentService: EnvironmentService, protected stateService: StateService,
protected storageService: StorageService) {
this.u2fSupported = this.platformUtilsService.supportsU2f(win);
}
@ -169,6 +173,8 @@ export class TwoFactorComponent implements OnInit, OnDestroy {
try {
this.formPromise = this.authService.logInTwoFactor(this.selectedProviderType, this.token, this.remember);
await this.formPromise;
const disableFavicon = await this.storageService.get<boolean>(ConstantsService.disableFaviconKey);
await this.stateService.save(ConstantsService.disableFaviconKey, !!disableFavicon);
if (this.onSuccessfulLogin != null) {
this.onSuccessfulLogin();
}