import { t } from "../../services/i18n.js"; import protectedSessionService from "../../services/protected_session.js"; import utils from "../../services/utils.js"; import BasicWidget from "../basic_widget.js"; const TPL = ` `; export default class ProtectedSessionPasswordDialog extends BasicWidget { doRender() { this.$widget = $(TPL); this.modal = bootstrap.Modal.getOrCreateInstance(this.$widget); this.$passwordForm = this.$widget.find(".protected-session-password-form"); this.$passwordInput = this.$widget.find(".protected-session-password"); this.$passwordForm.on('submit', () => { const password = this.$passwordInput.val(); this.$passwordInput.val(""); protectedSessionService.setupProtectedSession(password); return false; }); } showProtectedSessionPasswordDialogEvent() { utils.openDialog(this.$widget); this.$passwordInput.trigger('focus'); } closeProtectedSessionPasswordDialogEvent() { this.modal.hide(); } }