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 7 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,
"username": self._reauth_username,
CFenner marked this conversation as resolved.
Show resolved Hide resolved
},
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: self._get_reauth_entry().title,
CFenner marked this conversation as resolved.
Show resolved Hide resolved
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
7 changes: 5 additions & 2 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 @@ -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: self._get_reauth_entry().title},
CFenner marked this conversation as resolved.
Show resolved Hide resolved
errors=errors,
)

@staticmethod
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()
6 changes: 5 additions & 1 deletion homeassistant/components/lyric/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
Expand Down Expand Up @@ -35,7 +36,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
3 changes: 2 additions & 1 deletion homeassistant/components/melcloud/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import voluptuous as vol

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

from .const import DOMAIN
Expand Down Expand Up @@ -101,6 +101,7 @@ async def async_step_reauth_confirm(
data_schema=vol.Schema(
{vol.Required(CONF_USERNAME): str, vol.Required(CONF_PASSWORD): str}
),
description_placeholders={CONF_NAME: self._get_reauth_entry().title},
errors=errors,
)

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

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 .const import DOMAIN
Expand Down Expand Up @@ -70,5 +70,8 @@ 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()
3 changes: 2 additions & 1 deletion homeassistant/components/myuplink/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from typing import Any

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

from .const import DOMAIN, OAUTH2_SCOPES
Expand Down Expand Up @@ -40,8 +41,8 @@ async def async_step_reauth_confirm(
if user_input is None:
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
6 changes: 5 additions & 1 deletion homeassistant/components/nest/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import voluptuous as vol

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

Expand Down Expand Up @@ -141,7 +142,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_user(
Expand Down
Loading
Loading