iobroker.lovelace
Version:
With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI
1 lines • 3.19 kB
JavaScript
"use strict";(self.rspackChunkhome_assistant_frontend=self.rspackChunkhome_assistant_frontend||[]).push([[79927],{7466:function(e,t,s){s.a(e,async function(e,a){try{s.r(t),s.d(t,{CloudForgotPasswordCard:function(){return v}});s(3362),s(62953);var i=s(40445),r=s(5124),o=s(67576),n=s(1087),l=s(89300),d=s(38962),h=(s(76776),s(91485)),c=s(71117),u=s(79007),p=s(14503),y=e([l,d,h]);[l,d,h]=y.then?(await y)():y;let g,_,m,P,w=e=>e;class v extends r.WF{render(){return this.cardLess?this._renderContent():(0,r.qy)(g||(g=w` <ha-card outlined .header="${0}"> ${0} </ha-card> `),this.localize(`ui.panel.${this.translationKeyPanel}.subtitle`),this._renderContent())}_renderContent(){var e;return(0,r.qy)(_||(_=w` <div class="card-content"> <p> ${0} </p> ${0} <ha-input autofocus id="email" label="${0}" .value="${0}" type="email" required .disabled="${0}" ="${0}" .validationMessage="${0}"></ha-input> </div> <div class="card-actions"> <ha-progress-button ="${0}" .progress="${0}"> ${0} </ha-progress-button> </div> `),this.localize(`ui.panel.${this.translationKeyPanel}.instructions`),this._error?(0,r.qy)(m||(m=w`<ha-alert alert-type="error">${0}</ha-alert>`),this._error):r.s6,this.localize(`ui.panel.${this.translationKeyPanel}.email`),null!==(e=this.email)&&void 0!==e?e:"",this._inProgress,this._keyDown,this.localize(`ui.panel.${this.translationKeyPanel}.email_error_msg`),this._handleEmailPasswordReset,this._inProgress,this.localize(`ui.panel.${this.translationKeyPanel}.send_reset_email`))}_keyDown(e){"Enter"===e.key&&this._handleEmailPasswordReset()}async _handleEmailPasswordReset(){var e;const t=this.emailField,s=null!==(e=t.value)&&void 0!==e?e:"";t.reportValidity()?(this._inProgress=!0,this._resetPassword(s)):t.focus()}static get styles(){return[p.RF,(0,r.AH)(P||(P=w`ha-card{max-width:600px;margin:0 auto;margin-top:24px}h1{margin:0}ha-input{width:100%}.card-actions{display:flex;justify-content:flex-end;align-items:center}`))]}constructor(...e){super(...e),this.translationKeyPanel="config.cloud.forgot_password",this.cardLess=!1,this._inProgress=!1,this._resetPassword=async e=>{this._inProgress=!0;try{this.hass?await(0,c.Ut)(this.hass,e):await(0,u.zN)(e),(0,n.r)(this,"cloud-email-changed",{value:e}),this._inProgress=!1,(0,n.r)(this,"cloud-done",{flashMessage:this.localize(`ui.panel.${this.translationKeyPanel}.check_your_email`)})}catch(t){this._inProgress=!1;"usernotfound"===(t&&t.body&&t.body.code)&&e!==e.toLowerCase()?await this._resetPassword(e.toLowerCase()):this._error=t&&t.body&&t.body.message?t.body.message:"Unknown error"}}}}(0,i.Cg)([(0,o.MZ)({attribute:!1})],v.prototype,"hass",void 0),(0,i.Cg)([(0,o.MZ)({attribute:!1})],v.prototype,"localize",void 0),(0,i.Cg)([(0,o.MZ)({attribute:"translation-key-panel"})],v.prototype,"translationKeyPanel",void 0),(0,i.Cg)([(0,o.MZ)()],v.prototype,"email",void 0),(0,i.Cg)([(0,o.MZ)({type:Boolean,attribute:"card-less"})],v.prototype,"cardLess",void 0),(0,i.Cg)([(0,o.wk)()],v.prototype,"_inProgress",void 0),(0,i.Cg)([(0,o.wk)()],v.prototype,"_error",void 0),(0,i.Cg)([(0,o.P)("#email",!0)],v.prototype,"emailField",void 0),v=(0,i.Cg)([(0,o.EM)("cloud-forgot-password-card")],v),a()}catch(g){a(g)}})}}]);