import { Location } from '@angular/common'; import { Component } from '@angular/core'; import { I18nService } from 'jslib/abstractions/i18n.service'; import { PasswordGenerationService } from 'jslib/abstractions/passwordGeneration.service'; import { PlatformUtilsService } from 'jslib/abstractions/platformUtils.service'; import { StateService } from 'jslib/abstractions/state.service'; import { CipherView } from 'jslib/models/view/cipherView'; import { PasswordGeneratorComponent as BasePasswordGeneratorComponent, } from 'jslib/angular/components/password-generator.component'; @Component({ selector: 'app-password-generator', templateUrl: 'password-generator.component.html', }) export class PasswordGeneratorComponent extends BasePasswordGeneratorComponent { private cipherState: CipherView; constructor(passwordGenerationService: PasswordGenerationService, platformUtilsService: PlatformUtilsService, i18nService: I18nService, private stateService: StateService, private location: Location) { super(passwordGenerationService, platformUtilsService, i18nService, window); } async ngOnInit() { await super.ngOnInit(); this.cipherState = await this.stateService.get('addEditCipher'); this.showSelect = this.cipherState != null; } select() { super.select(); this.cipherState.login.password = this.password; this.close(); } close() { this.location.back(); } }