import { Component } from '../../../../lib/vues6/vues6.js' import { utility } from '../../../service/Utility.service.js' import { auth_api } from '../../../service/AuthApi.service.js' const template = ` ` export default class AppPasswordFormComponent extends Component { static get selector() { return 'coreid-form-app-password' } static get template() { return template } static get props() { return [] } name = '' valid = false uuid = '' enable_form = true display_password = '' vue_on_create() { this.uuid = utility.uuid() console.log({auth_api}) } async on_name_change(event) { this.valid = this.name.trim().length > 0 if ( event.keyCode === 13 ) { // Enter was pressed event.preventDefault() event.stopPropagation() if ( this.valid && this.enable_form ) await this.generate_pw() } } trigger() { this.name = '' this.valid = false this.enable_form = true this.display_password = '' this.$nextTick(() => { $(this.$refs.modal).modal() }) } async generate_pw() { this.enable_form = false const result = await auth_api.create_app_password(this.name) this.display_password = result.password } }