Hide change password card for non-homeassistant auth_providers. (#1526)

This commit is contained in:
Jerad Meisner 2018-07-26 23:27:59 -07:00 committed by Paulus Schoutsen
parent fdbaa3908a
commit be7fb50f8c

View File

@ -53,7 +53,9 @@ class HaPanelProfile extends EventsMixin(PolymerElement) {
>Log out</paper-button> >Log out</paper-button>
</div> </div>
</paper-card> </paper-card>
<template is="dom-if" if="[[_canChangePassword(hass.user)]]">
<ha-change-password-card hass="[[hass]]"></ha-change-password-card> <ha-change-password-card hass="[[hass]]"></ha-change-password-card>
</template>
</div> </div>
</app-header-layout> </app-header-layout>
`; `;
@ -70,6 +72,10 @@ class HaPanelProfile extends EventsMixin(PolymerElement) {
_handleLogOut() { _handleLogOut() {
this.fire('hass-logout'); this.fire('hass-logout');
} }
_canChangePassword(user) {
return user.credentials.some(cred => cred.auth_provider_type === 'homeassistant');
}
} }
customElements.define('ha-panel-profile', HaPanelProfile); customElements.define('ha-panel-profile', HaPanelProfile);