Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix reauth config flow title #129134

Draft
wants to merge 12 commits into
base: dev
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions homeassistant/components/aosmith/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import voluptuous as vol

from homeassistant.config_entries import ConfigFlow, ConfigFlowResult
from homeassistant.const import CONF_EMAIL, CONF_PASSWORD
from homeassistant.const import CONF_EMAIL, CONF_NAME, CONF_PASSWORD
from homeassistant.helpers import aiohttp_client

from .const import DOMAIN
Expand Down Expand Up @@ -99,6 +99,9 @@ async def async_step_reauth_confirm(
return self.async_show_form(
step_id="reauth_confirm",
data_schema=vol.Schema({vol.Required(CONF_PASSWORD): str}),
description_placeholders={CONF_EMAIL: self._reauth_email},
description_placeholders={
CONF_EMAIL: self._reauth_email,
CONF_NAME: self._get_reauth_entry().title,
},
errors=errors,
)
7 changes: 5 additions & 2 deletions homeassistant/components/aussie_broadband/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import voluptuous as vol

from homeassistant.config_entries import ConfigFlow, ConfigFlowResult
from homeassistant.const import CONF_PASSWORD, CONF_USERNAME
from homeassistant.const import CONF_NAME, CONF_PASSWORD, CONF_USERNAME
from homeassistant.helpers.aiohttp_client import async_get_clientsession

from .const import CONF_SERVICES, DOMAIN
Expand Down Expand Up @@ -105,7 +105,10 @@ async def async_step_reauth_confirm(

return self.async_show_form(
step_id="reauth_confirm",
description_placeholders={"username": self._reauth_username},
description_placeholders={
CONF_NAME: self._get_reauth_entry().title,
CONF_USERNAME: self._reauth_username,
},
data_schema=vol.Schema(
{
vol.Required(CONF_PASSWORD): str,
Expand Down
3 changes: 2 additions & 1 deletion homeassistant/components/bosch_shc/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

from homeassistant.components import zeroconf
from homeassistant.config_entries import ConfigFlow, ConfigFlowResult
from homeassistant.const import CONF_HOST, CONF_PASSWORD, CONF_TOKEN
from homeassistant.const import CONF_HOST, CONF_NAME, CONF_PASSWORD, CONF_TOKEN
from homeassistant.core import HomeAssistant

from .const import (
Expand Down Expand Up @@ -108,6 +108,7 @@ async def async_step_reauth_confirm(
return self.async_show_form(
step_id="reauth_confirm",
data_schema=HOST_SCHEMA,
description_placeholders={CONF_NAME: self._get_reauth_entry().title},
)
self.host = user_input[CONF_HOST]
self.info = await self._get_info(self.host)
Expand Down
15 changes: 11 additions & 4 deletions homeassistant/components/caldav/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,13 @@
import voluptuous as vol

from homeassistant.config_entries import ConfigFlow, ConfigFlowResult
from homeassistant.const import CONF_PASSWORD, CONF_URL, CONF_USERNAME, CONF_VERIFY_SSL
from homeassistant.const import (
CONF_NAME,
CONF_PASSWORD,
CONF_URL,
CONF_USERNAME,
CONF_VERIFY_SSL,
)
from homeassistant.helpers import config_validation as cv

from .const import DOMAIN
Expand Down Expand Up @@ -107,14 +113,15 @@ async def async_step_reauth_confirm(
return self.async_update_reload_and_abort(reauth_entry, data=user_input)

return self.async_show_form(
description_placeholders={
CONF_USERNAME: reauth_entry.data[CONF_USERNAME],
},
step_id="reauth_confirm",
data_schema=vol.Schema(
{
vol.Required(CONF_PASSWORD): str,
}
),
description_placeholders={
CONF_NAME: reauth_entry.title,
CONF_USERNAME: reauth_entry.data[CONF_USERNAME],
},
errors=errors,
)
6 changes: 5 additions & 1 deletion homeassistant/components/electric_kiwi/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from typing import Any

from homeassistant.config_entries import ConfigFlowResult
from homeassistant.const import CONF_NAME
from homeassistant.helpers import config_entry_oauth2_flow

from .const import DOMAIN, SCOPE_VALUES
Expand Down Expand Up @@ -40,7 +41,10 @@ async def async_step_reauth_confirm(
) -> ConfigFlowResult:
"""Dialog that informs the user that reauth is required."""
if user_input is None:
return self.async_show_form(step_id="reauth_confirm")
return self.async_show_form(
step_id="reauth_confirm",
description_placeholders={CONF_NAME: self._get_reauth_entry().title},
)
return await self.async_step_user()

async def async_oauth_create_entry(self, data: dict) -> ConfigFlowResult:
Expand Down
2 changes: 2 additions & 0 deletions homeassistant/components/ezviz/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
from homeassistant.const import (
CONF_CUSTOMIZE,
CONF_IP_ADDRESS,
CONF_NAME,
CONF_PASSWORD,
CONF_TIMEOUT,
CONF_TYPE,
Expand Down Expand Up @@ -384,6 +385,7 @@ async def async_step_reauth_confirm(
return self.async_show_form(
step_id="reauth_confirm",
data_schema=data_schema,
description_placeholders={CONF_NAME: self._get_reauth_entry().title},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should not be handling it this way. Let's see if we can make it smarter and inject name automatically. This is not something every integration should have to do.

errors=errors,
)

Expand Down
7 changes: 5 additions & 2 deletions homeassistant/components/fitbit/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from typing import Any

from homeassistant.config_entries import SOURCE_REAUTH, ConfigFlowResult
from homeassistant.const import CONF_TOKEN
from homeassistant.const import CONF_NAME, CONF_TOKEN
from homeassistant.helpers import config_entry_oauth2_flow

from . import api
Expand Down Expand Up @@ -46,7 +46,10 @@ async def async_step_reauth_confirm(
) -> ConfigFlowResult:
"""Confirm reauth dialog."""
if user_input is None:
return self.async_show_form(step_id="reauth_confirm")
return self.async_show_form(
step_id="reauth_confirm",
description_placeholders={CONF_NAME: self._get_reauth_entry().title},
)
return await self.async_step_user()

async def async_step_creation(
Expand Down
6 changes: 5 additions & 1 deletion homeassistant/components/geocaching/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from geocachingapi.geocachingapi import GeocachingApi

from homeassistant.config_entries import ConfigFlowResult
from homeassistant.const import CONF_NAME
from homeassistant.helpers.aiohttp_client import async_get_clientsession
from homeassistant.helpers.config_entry_oauth2_flow import AbstractOAuth2FlowHandler

Expand Down Expand Up @@ -37,7 +38,10 @@ async def async_step_reauth_confirm(
) -> ConfigFlowResult:
"""Dialog that informs the user that reauth is required."""
if user_input is None:
return self.async_show_form(step_id="reauth_confirm")
return self.async_show_form(
step_id="reauth_confirm",
description_placeholders={CONF_NAME: self._get_reauth_entry().title},
)
return await self.async_step_user()

async def async_oauth_create_entry(self, data: dict[str, Any]) -> ConfigFlowResult:
Expand Down
6 changes: 5 additions & 1 deletion homeassistant/components/google/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
ConfigFlowResult,
OptionsFlow,
)
from homeassistant.const import CONF_NAME
from homeassistant.core import callback
from homeassistant.helpers import config_entry_oauth2_flow
from homeassistant.helpers.aiohttp_client import async_get_clientsession
Expand Down Expand Up @@ -229,7 +230,10 @@ async def async_step_reauth_confirm(
) -> ConfigFlowResult:
"""Confirm reauth dialog."""
if user_input is None:
return self.async_show_form(step_id="reauth_confirm")
return self.async_show_form(
step_id="reauth_confirm",
description_placeholders={CONF_NAME: self._get_reauth_entry().title},
)
return await self.async_step_user()

@staticmethod
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
ConfigFlowResult,
OptionsFlow,
)
from homeassistant.const import CONF_NAME
from homeassistant.core import callback
from homeassistant.helpers import config_entry_oauth2_flow

Expand Down Expand Up @@ -56,7 +57,10 @@ async def async_step_reauth_confirm(
) -> ConfigFlowResult:
"""Confirm reauth dialog."""
if user_input is None:
return self.async_show_form(step_id="reauth_confirm")
return self.async_show_form(
step_id="reauth_confirm",
description_placeholders={CONF_NAME: self._get_reauth_entry().title},
)
return await self.async_step_user()

async def async_oauth_create_entry(self, data: dict[str, Any]) -> ConfigFlowResult:
Expand Down
7 changes: 5 additions & 2 deletions homeassistant/components/google_mail/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from googleapiclient.discovery import build

from homeassistant.config_entries import SOURCE_REAUTH, ConfigFlowResult
from homeassistant.const import CONF_ACCESS_TOKEN, CONF_TOKEN
from homeassistant.const import CONF_ACCESS_TOKEN, CONF_NAME, CONF_TOKEN
from homeassistant.helpers import config_entry_oauth2_flow

from .const import DEFAULT_ACCESS, DOMAIN
Expand Down Expand Up @@ -49,7 +49,10 @@ async def async_step_reauth_confirm(
) -> ConfigFlowResult:
"""Confirm reauth dialog."""
if user_input is None:
return self.async_show_form(step_id="reauth_confirm")
return self.async_show_form(
step_id="reauth_confirm",
description_placeholders={CONF_NAME: self._get_reauth_entry().title},
)
return await self.async_step_user()

async def async_oauth_create_entry(self, data: dict[str, Any]) -> ConfigFlowResult:
Expand Down
7 changes: 5 additions & 2 deletions homeassistant/components/google_sheets/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from gspread import Client, GSpreadException

from homeassistant.config_entries import SOURCE_REAUTH, ConfigFlowResult
from homeassistant.const import CONF_ACCESS_TOKEN, CONF_TOKEN
from homeassistant.const import CONF_ACCESS_TOKEN, CONF_NAME, CONF_TOKEN
from homeassistant.helpers import config_entry_oauth2_flow

from .const import DEFAULT_ACCESS, DEFAULT_NAME, DOMAIN
Expand Down Expand Up @@ -51,7 +51,10 @@ async def async_step_reauth_confirm(
) -> ConfigFlowResult:
"""Confirm reauth dialog."""
if user_input is None:
return self.async_show_form(step_id="reauth_confirm")
return self.async_show_form(
step_id="reauth_confirm",
description_placeholders={CONF_NAME: self._get_reauth_entry().title},
)
return await self.async_step_user()

async def async_oauth_create_entry(self, data: dict[str, Any]) -> ConfigFlowResult:
Expand Down
1 change: 1 addition & 0 deletions homeassistant/components/huawei_lte/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ async def _async_show_reauth_form(
): str,
}
),
description_placeholders={CONF_NAME: self._get_reauth_entry().title},
errors=errors or {},
)

Expand Down
7 changes: 5 additions & 2 deletions homeassistant/components/icloud/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import voluptuous as vol

from homeassistant.config_entries import ConfigFlow, ConfigFlowResult
from homeassistant.const import CONF_PASSWORD, CONF_USERNAME
from homeassistant.const import CONF_NAME, CONF_PASSWORD, CONF_USERNAME
from homeassistant.helpers.storage import Store

from .const import (
Expand Down Expand Up @@ -196,7 +196,10 @@ async def async_step_reauth_confirm(
) -> ConfigFlowResult:
"""Update password for a config entry that can't authenticate."""
if user_input is None:
return self._show_setup_form(step_id="reauth_confirm")
return self.async_show_form(
step_id="reauth_confirm",
description_placeholders={CONF_NAME: self._get_reauth_entry().title},
)

return await self._validate_and_create_entry(user_input, "reauth_confirm")

Expand Down
9 changes: 6 additions & 3 deletions homeassistant/components/jellyfin/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
ConfigFlowResult,
OptionsFlowWithConfigEntry,
)
from homeassistant.const import CONF_PASSWORD, CONF_URL, CONF_USERNAME
from homeassistant.const import CONF_NAME, CONF_PASSWORD, CONF_URL, CONF_USERNAME
from homeassistant.core import callback
from homeassistant.util.uuid import random_uuid_hex

Expand Down Expand Up @@ -115,8 +115,8 @@ async def async_step_reauth_confirm(
"""Dialog that informs the user that reauth is required."""
errors: dict[str, str] = {}

reauth_entry = self._get_reauth_entry()
if user_input is not None:
reauth_entry = self._get_reauth_entry()
new_input = reauth_entry.data | user_input

if self.client_device_id is None:
Expand All @@ -136,7 +136,10 @@ async def async_step_reauth_confirm(
return self.async_update_reload_and_abort(reauth_entry, data=new_input)

return self.async_show_form(
step_id="reauth_confirm", data_schema=REAUTH_DATA_SCHEMA, errors=errors
step_id="reauth_confirm",
data_schema=REAUTH_DATA_SCHEMA,
description_placeholders={CONF_NAME: reauth_entry.title},
errors=errors,
)

@staticmethod
Expand Down
5 changes: 3 additions & 2 deletions homeassistant/components/jvc_projector/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import voluptuous as vol

from homeassistant.config_entries import ConfigFlow, ConfigFlowResult
from homeassistant.const import CONF_HOST, CONF_PASSWORD, CONF_PORT
from homeassistant.const import CONF_HOST, CONF_NAME, CONF_PASSWORD, CONF_PORT
from homeassistant.helpers.device_registry import format_mac
from homeassistant.util.network import is_host_valid

Expand Down Expand Up @@ -83,8 +83,8 @@ async def async_step_reauth_confirm(
"""Dialog that informs the user that reauth is required."""
errors = {}

reauth_entry = self._get_reauth_entry()
if user_input is not None:
reauth_entry = self._get_reauth_entry()
host = reauth_entry.data[CONF_HOST]
port = reauth_entry.data[CONF_PORT]
password = user_input[CONF_PASSWORD]
Expand All @@ -103,6 +103,7 @@ async def async_step_reauth_confirm(
return self.async_show_form(
step_id="reauth_confirm",
data_schema=vol.Schema({vol.Optional(CONF_PASSWORD): str}),
description_placeholders={CONF_NAME: reauth_entry.title},
errors=errors,
)

Expand Down
3 changes: 2 additions & 1 deletion homeassistant/components/laundrify/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from voluptuous import Required, Schema

from homeassistant.config_entries import ConfigFlow, ConfigFlowResult
from homeassistant.const import CONF_ACCESS_TOKEN, CONF_CODE
from homeassistant.const import CONF_ACCESS_TOKEN, CONF_CODE, CONF_NAME
from homeassistant.helpers.aiohttp_client import async_get_clientsession

from .const import DOMAIN
Expand Down Expand Up @@ -92,5 +92,6 @@ async def async_step_reauth_confirm(
return self.async_show_form(
step_id="reauth_confirm",
data_schema=Schema({}),
description_placeholders={CONF_NAME: self._get_reauth_entry().title},
)
return await self.async_step_init()
7 changes: 5 additions & 2 deletions homeassistant/components/lidarr/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import voluptuous as vol

from homeassistant.config_entries import SOURCE_REAUTH, ConfigFlow, ConfigFlowResult
from homeassistant.const import CONF_API_KEY, CONF_URL, CONF_VERIFY_SSL
from homeassistant.const import CONF_API_KEY, CONF_NAME, CONF_URL, CONF_VERIFY_SSL
from homeassistant.core import HomeAssistant
from homeassistant.helpers.aiohttp_client import async_get_clientsession

Expand All @@ -37,7 +37,10 @@ async def async_step_reauth_confirm(
return await self.async_step_user()

self._set_confirm_only()
return self.async_show_form(step_id="reauth_confirm")
return self.async_show_form(
step_id="reauth_confirm",
description_placeholders={CONF_NAME: self._get_reauth_entry().title},
)

async def async_step_user(
self, user_input: dict[str, Any] | None = None
Expand Down
7 changes: 5 additions & 2 deletions homeassistant/components/litterrobot/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import voluptuous as vol

from homeassistant.config_entries import ConfigFlow, ConfigFlowResult
from homeassistant.const import CONF_PASSWORD, CONF_USERNAME
from homeassistant.const import CONF_NAME, CONF_PASSWORD, CONF_USERNAME
from homeassistant.helpers.aiohttp_client import async_get_clientsession

from .const import DOMAIN
Expand Down Expand Up @@ -53,7 +53,10 @@ async def async_step_reauth_confirm(
return self.async_show_form(
step_id="reauth_confirm",
data_schema=vol.Schema({vol.Required(CONF_PASSWORD): str}),
description_placeholders={CONF_USERNAME: self.username},
description_placeholders={
CONF_NAME: self._get_reauth_entry().title,
CONF_USERNAME: self.username,
},
errors=errors,
)

Expand Down
Loading
Loading