mirror of
https://github.com/home-assistant/core.git
synced 2025-07-18 18:57:06 +00:00
Use reauth helpers in jellyfin (#128648)
This commit is contained in:
parent
bf9b35d670
commit
7a77a3d7ce
@ -56,7 +56,6 @@ class JellyfinConfigFlow(ConfigFlow, domain=DOMAIN):
|
||||
def __init__(self) -> None:
|
||||
"""Initialize the Jellyfin config flow."""
|
||||
self.client_device_id: str | None = None
|
||||
self.entry: JellyfinConfigEntry | None = None
|
||||
|
||||
async def async_step_user(
|
||||
self, user_input: dict[str, Any] | None = None
|
||||
@ -108,7 +107,6 @@ class JellyfinConfigFlow(ConfigFlow, domain=DOMAIN):
|
||||
self, entry_data: Mapping[str, Any]
|
||||
) -> ConfigFlowResult:
|
||||
"""Perform reauth upon an API authentication error."""
|
||||
self.entry = self.hass.config_entries.async_get_entry(self.context["entry_id"])
|
||||
return await self.async_step_reauth_confirm()
|
||||
|
||||
async def async_step_reauth_confirm(
|
||||
@ -118,8 +116,8 @@ class JellyfinConfigFlow(ConfigFlow, domain=DOMAIN):
|
||||
errors: dict[str, str] = {}
|
||||
|
||||
if user_input is not None:
|
||||
assert self.entry is not None
|
||||
new_input = self.entry.data | user_input
|
||||
reauth_entry = self._get_reauth_entry()
|
||||
new_input = reauth_entry.data | user_input
|
||||
|
||||
if self.client_device_id is None:
|
||||
self.client_device_id = _generate_client_device_id()
|
||||
@ -135,10 +133,7 @@ class JellyfinConfigFlow(ConfigFlow, domain=DOMAIN):
|
||||
errors["base"] = "unknown"
|
||||
_LOGGER.exception("Unexpected exception")
|
||||
else:
|
||||
self.hass.config_entries.async_update_entry(self.entry, data=new_input)
|
||||
|
||||
await self.hass.config_entries.async_reload(self.entry.entry_id)
|
||||
return self.async_abort(reason="reauth_successful")
|
||||
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
|
||||
|
Loading…
x
Reference in New Issue
Block a user