diff --git a/api/js/etemplate/Et2Textbox/Et2Password.ts b/api/js/etemplate/Et2Textbox/Et2Password.ts index 12a9ef2673..fe54f318c1 100644 --- a/api/js/etemplate/Et2Textbox/Et2Password.ts +++ b/api/js/etemplate/Et2Textbox/Et2Password.ts @@ -11,6 +11,11 @@ import {Et2InvokerMixin} from "../Et2Url/Et2InvokerMixin"; import {Et2Textbox} from "./Et2Textbox"; import {Et2Dialog} from "../Et2Dialog/Et2Dialog"; +import {classMap, html, ifDefined} from "@lion/core"; +import {egw} from "../../jsapi/egw_global"; + +const isChromium = navigator.userAgentData?.brands.some(b => b.brand.includes('Chromium')); +const isFirefox = isChromium ? false : navigator.userAgent.includes('Firefox'); /** * @customElement et2-password @@ -53,6 +58,16 @@ export class Et2Password extends Et2InvokerMixin(Et2Textbox) }; } + connectedCallback() + { + super.connectedCallback(); + this.autocomplete = "new-password"; + this.updateComplete.then(() => + { + this.shadowRoot.querySelector("[type='password']").autocomplete = "new-password"; + }); + } + transformAttributes(attrs) { if(typeof attrs.suggest !== "undefined") @@ -61,7 +76,7 @@ export class Et2Password extends Et2InvokerMixin(Et2Textbox) } attrs.type = 'password'; - if (attrs.viewable) + if(attrs.viewable) { attrs['toggle-password'] = true; } @@ -181,6 +196,157 @@ export class Et2Password extends Et2InvokerMixin(Et2Textbox) this.egw().lang("Authenticate") ); } + + render() + { + const hasLabelSlot = this.hasSlotController.test('label'); + const hasHelpTextSlot = this.hasSlotController.test('help-text'); + const hasLabel = this.label ? true : !!hasLabelSlot; + const hasHelpText = this.helpText ? true : !!hasHelpTextSlot; + const hasClearIcon = + this.clearable && !this.disabled && !this.readonly && (typeof this.value === 'number' || this.value.length > 0); + + return html` +