From 1a2ebabd22f4dfd9d308865ae630333bba7d96c4 Mon Sep 17 00:00:00 2001 From: Ian Richardson Date: Sun, 19 Jan 2020 00:02:36 -0600 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=B8=20prompt=20user=20to=20confirm=20l?= =?UTF-8?q?ogout=20(#4501)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 🚸 prompt user to confirm logout * 👌 update dialog title/text/confirm --- src/panels/profile/ha-panel-profile.ts | 8 +++++++- src/translations/en.json | 2 ++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/panels/profile/ha-panel-profile.ts b/src/panels/profile/ha-panel-profile.ts index 1848660140..1331e068fd 100644 --- a/src/panels/profile/ha-panel-profile.ts +++ b/src/panels/profile/ha-panel-profile.ts @@ -37,6 +37,7 @@ import { haStyle } from "../../resources/styles"; import { HomeAssistant } from "../../types"; import { fireEvent } from "../../common/dom/fire_event"; import { UnsubscribeFunc } from "home-assistant-js-websocket"; +import { showConfirmationDialog } from "../../dialogs/confirmation/show-dialog-confirmation"; class HaPanelProfile extends LitElement { @property() public hass!: HomeAssistant; @@ -173,7 +174,12 @@ class HaPanelProfile extends LitElement { } private _handleLogOut() { - fireEvent(this, "hass-logout"); + showConfirmationDialog(this, { + title: this.hass.localize("ui.panel.profile.logout_title"), + text: this.hass.localize("ui.panel.profile.logout_text"), + confirmBtnText: this.hass.localize("ui.panel.profile.logout"), + confirm: () => fireEvent(this, "hass-logout"), + }); } static get styles(): CSSResultArray { diff --git a/src/translations/en.json b/src/translations/en.json index 448baa3b93..5680b7d5ad 100755 --- a/src/translations/en.json +++ b/src/translations/en.json @@ -1848,6 +1848,8 @@ "current_user": "You are currently logged in as {fullName}.", "is_owner": "You are an owner.", "logout": "Log out", + "logout_title": "Log out?", + "logout_text": "Are you sure you want to log out?", "force_narrow": { "header": "Always hide the sidebar", "description": "This will hide the sidebar by default, similar to the mobile experience."