mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-23 09:16:38 +00:00
Add autocomplete to onboarding, cloud, and password change (#14040)
This commit is contained in:
parent
8444fe0a07
commit
a4fcb743fa
@ -39,7 +39,7 @@ export class HaTextSelector extends LitElement {
|
|||||||
.disabled=${this.disabled}
|
.disabled=${this.disabled}
|
||||||
@input=${this._handleChange}
|
@input=${this._handleChange}
|
||||||
autocapitalize="none"
|
autocapitalize="none"
|
||||||
autocomplete="off"
|
.autocomplete=${this.selector.text.autofill}
|
||||||
spellcheck="false"
|
spellcheck="false"
|
||||||
.required=${this.required}
|
.required=${this.required}
|
||||||
autogrow
|
autogrow
|
||||||
@ -59,6 +59,7 @@ export class HaTextSelector extends LitElement {
|
|||||||
html`<div style="width: 24px"></div>`
|
html`<div style="width: 24px"></div>`
|
||||||
: this.selector.text?.suffix}
|
: this.selector.text?.suffix}
|
||||||
.required=${this.required}
|
.required=${this.required}
|
||||||
|
.autocomplete=${this.selector.text.autofill}
|
||||||
></ha-textfield>
|
></ha-textfield>
|
||||||
${this.selector.text?.type === "password"
|
${this.selector.text?.type === "password"
|
||||||
? html`<ha-icon-button
|
? html`<ha-icon-button
|
||||||
|
@ -15,6 +15,8 @@ export class HaTextField extends TextFieldBase {
|
|||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
@property({ type: Boolean }) public iconTrailing?: boolean;
|
@property({ type: Boolean }) public iconTrailing?: boolean;
|
||||||
|
|
||||||
|
@property() public autocomplete?: string;
|
||||||
|
|
||||||
override updated(changedProperties: PropertyValues) {
|
override updated(changedProperties: PropertyValues) {
|
||||||
super.updated(changedProperties);
|
super.updated(changedProperties);
|
||||||
if (
|
if (
|
||||||
@ -27,6 +29,13 @@ export class HaTextField extends TextFieldBase {
|
|||||||
);
|
);
|
||||||
this.reportValidity();
|
this.reportValidity();
|
||||||
}
|
}
|
||||||
|
if (changedProperties.has("autocomplete")) {
|
||||||
|
if (this.autocomplete) {
|
||||||
|
this.formElement.setAttribute("autocomplete", this.autocomplete);
|
||||||
|
} else {
|
||||||
|
this.formElement.removeAttribute("autocomplete");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override renderIcon(
|
protected override renderIcon(
|
||||||
|
@ -232,6 +232,7 @@ export interface StringSelector {
|
|||||||
| "datetime-local"
|
| "datetime-local"
|
||||||
| "color";
|
| "color";
|
||||||
suffix?: string;
|
suffix?: string;
|
||||||
|
autofill?: string;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,17 +18,21 @@ import { onboardUserStep } from "../data/onboarding";
|
|||||||
import { PolymerChangedEvent } from "../polymer-types";
|
import { PolymerChangedEvent } from "../polymer-types";
|
||||||
|
|
||||||
const CREATE_USER_SCHEMA: HaFormSchema[] = [
|
const CREATE_USER_SCHEMA: HaFormSchema[] = [
|
||||||
{ name: "name", required: true, selector: { text: {} } },
|
{ name: "name", required: true, selector: { text: { autofill: "name" } } },
|
||||||
{ name: "username", required: true, selector: { text: {} } },
|
{
|
||||||
|
name: "username",
|
||||||
|
required: true,
|
||||||
|
selector: { text: { autofill: "username" } },
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: "password",
|
name: "password",
|
||||||
required: true,
|
required: true,
|
||||||
selector: { text: { type: "password" } },
|
selector: { text: { type: "password", autofill: "new-password" } },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "password_confirm",
|
name: "password_confirm",
|
||||||
required: true,
|
required: true,
|
||||||
selector: { text: { type: "password" } },
|
selector: { text: { type: "password", autofill: "new-password" } },
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -114,6 +114,7 @@ export class CloudLogin extends LitElement {
|
|||||||
)}
|
)}
|
||||||
id="email"
|
id="email"
|
||||||
type="email"
|
type="email"
|
||||||
|
autocomplete="username"
|
||||||
required
|
required
|
||||||
.value=${this.email}
|
.value=${this.email}
|
||||||
@keydown=${this._keyDown}
|
@keydown=${this._keyDown}
|
||||||
@ -129,6 +130,7 @@ export class CloudLogin extends LitElement {
|
|||||||
)}
|
)}
|
||||||
.value=${this._password || ""}
|
.value=${this._password || ""}
|
||||||
type="password"
|
type="password"
|
||||||
|
autocomplete="current-password"
|
||||||
required
|
required
|
||||||
minlength="8"
|
minlength="8"
|
||||||
@keydown=${this._keyDown}
|
@keydown=${this._keyDown}
|
||||||
|
@ -136,6 +136,7 @@ export class CloudRegister extends LitElement {
|
|||||||
"ui.panel.config.cloud.register.email_address"
|
"ui.panel.config.cloud.register.email_address"
|
||||||
)}
|
)}
|
||||||
type="email"
|
type="email"
|
||||||
|
autocomplete="email"
|
||||||
required
|
required
|
||||||
.value=${this.email}
|
.value=${this.email}
|
||||||
@keydown=${this._keyDown}
|
@keydown=${this._keyDown}
|
||||||
@ -148,6 +149,7 @@ export class CloudRegister extends LitElement {
|
|||||||
label="Password"
|
label="Password"
|
||||||
.value=${this._password}
|
.value=${this._password}
|
||||||
type="password"
|
type="password"
|
||||||
|
autocomplete="new-password"
|
||||||
minlength="8"
|
minlength="8"
|
||||||
required
|
required
|
||||||
@keydown=${this._keyDown}
|
@keydown=${this._keyDown}
|
||||||
|
@ -20,6 +20,7 @@ const SCHEMA = [
|
|||||||
selector: {
|
selector: {
|
||||||
text: {
|
text: {
|
||||||
type: "password",
|
type: "password",
|
||||||
|
autofill: "new-password",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -29,6 +30,7 @@ const SCHEMA = [
|
|||||||
selector: {
|
selector: {
|
||||||
text: {
|
text: {
|
||||||
type: "password",
|
type: "password",
|
||||||
|
autofill: "new-password",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -55,6 +55,7 @@ class HaChangePasswordCard extends LitElement {
|
|||||||
"ui.panel.profile.change_password.current_password"
|
"ui.panel.profile.change_password.current_password"
|
||||||
)}
|
)}
|
||||||
type="password"
|
type="password"
|
||||||
|
autocomplete="current-password"
|
||||||
.value=${this._currentPassword}
|
.value=${this._currentPassword}
|
||||||
@input=${this._currentPasswordChanged}
|
@input=${this._currentPasswordChanged}
|
||||||
required
|
required
|
||||||
@ -67,6 +68,7 @@ class HaChangePasswordCard extends LitElement {
|
|||||||
)}
|
)}
|
||||||
name="password"
|
name="password"
|
||||||
type="password"
|
type="password"
|
||||||
|
autocomplete="new-password"
|
||||||
.value=${this._password}
|
.value=${this._password}
|
||||||
@change=${this._newPasswordChanged}
|
@change=${this._newPasswordChanged}
|
||||||
required
|
required
|
||||||
@ -78,6 +80,7 @@ class HaChangePasswordCard extends LitElement {
|
|||||||
)}
|
)}
|
||||||
name="passwordConfirm"
|
name="passwordConfirm"
|
||||||
type="password"
|
type="password"
|
||||||
|
autocomplete="new-password"
|
||||||
.value=${this._passwordConfirm}
|
.value=${this._passwordConfirm}
|
||||||
@input=${this._newPasswordConfirmChanged}
|
@input=${this._newPasswordConfirmChanged}
|
||||||
required
|
required
|
||||||
|
Loading…
x
Reference in New Issue
Block a user