mirror of
https://github.com/bitwarden/browser
synced 2025-12-17 00:33:44 +00:00
success callbacks
This commit is contained in:
@@ -11,6 +11,7 @@ export class HintComponent {
|
|||||||
formPromise: Promise<any>;
|
formPromise: Promise<any>;
|
||||||
|
|
||||||
protected successRoute = 'login';
|
protected successRoute = 'login';
|
||||||
|
protected onSuccessfulSubmit: () => void;
|
||||||
|
|
||||||
constructor(protected router: Router, protected i18nService: I18nService,
|
constructor(protected router: Router, protected i18nService: I18nService,
|
||||||
protected apiService: ApiService, protected platformUtilsService: PlatformUtilsService) { }
|
protected apiService: ApiService, protected platformUtilsService: PlatformUtilsService) { }
|
||||||
@@ -32,7 +33,11 @@ export class HintComponent {
|
|||||||
await this.formPromise;
|
await this.formPromise;
|
||||||
this.platformUtilsService.eventTrack('Requested Hint');
|
this.platformUtilsService.eventTrack('Requested Hint');
|
||||||
this.platformUtilsService.showToast('success', null, this.i18nService.t('masterPassSent'));
|
this.platformUtilsService.showToast('success', null, this.i18nService.t('masterPassSent'));
|
||||||
this.router.navigate([this.successRoute]);
|
if (this.onSuccessfulSubmit != null) {
|
||||||
|
this.onSuccessfulSubmit();
|
||||||
|
} else if (this.router != null) {
|
||||||
|
this.router.navigate([this.successRoute]);
|
||||||
|
}
|
||||||
} catch { }
|
} catch { }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ export class LockComponent {
|
|||||||
showPassword: boolean = false;
|
showPassword: boolean = false;
|
||||||
|
|
||||||
protected successRoute: string = 'vault';
|
protected successRoute: string = 'vault';
|
||||||
|
protected onSuccessfulSubmit: () => void;
|
||||||
|
|
||||||
constructor(protected router: Router, protected i18nService: I18nService,
|
constructor(protected router: Router, protected i18nService: I18nService,
|
||||||
protected platformUtilsService: PlatformUtilsService, protected messagingService: MessagingService,
|
protected platformUtilsService: PlatformUtilsService, protected messagingService: MessagingService,
|
||||||
@@ -33,7 +34,11 @@ export class LockComponent {
|
|||||||
if (storedKeyHash != null && keyHash != null && storedKeyHash === keyHash) {
|
if (storedKeyHash != null && keyHash != null && storedKeyHash === keyHash) {
|
||||||
await this.cryptoService.setKey(key);
|
await this.cryptoService.setKey(key);
|
||||||
this.messagingService.send('unlocked');
|
this.messagingService.send('unlocked');
|
||||||
this.router.navigate([this.successRoute]);
|
if (this.onSuccessfulSubmit != null) {
|
||||||
|
this.onSuccessfulSubmit();
|
||||||
|
} else if (this.router != null) {
|
||||||
|
this.router.navigate([this.successRoute]);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
this.platformUtilsService.showToast('error', this.i18nService.t('errorOccurred'),
|
this.platformUtilsService.showToast('error', this.i18nService.t('errorOccurred'),
|
||||||
this.i18nService.t('invalidMasterPassword'));
|
this.i18nService.t('invalidMasterPassword'));
|
||||||
|
|||||||
Reference in New Issue
Block a user