mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 05:07:41 +00:00
Use reauth helpers in deluge config flow (#127445)
This commit is contained in:
parent
07bc9f6477
commit
255cf6b305
@ -10,13 +10,7 @@ from deluge_client.client import DelugeRPCClient
|
|||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.config_entries import SOURCE_REAUTH, ConfigFlow, ConfigFlowResult
|
from homeassistant.config_entries import SOURCE_REAUTH, ConfigFlow, ConfigFlowResult
|
||||||
from homeassistant.const import (
|
from homeassistant.const import CONF_HOST, CONF_PASSWORD, CONF_PORT, CONF_USERNAME
|
||||||
CONF_HOST,
|
|
||||||
CONF_PASSWORD,
|
|
||||||
CONF_PORT,
|
|
||||||
CONF_SOURCE,
|
|
||||||
CONF_USERNAME,
|
|
||||||
)
|
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
|
|
||||||
from .const import (
|
from .const import (
|
||||||
@ -44,12 +38,10 @@ class DelugeFlowHandler(ConfigFlow, domain=DOMAIN):
|
|||||||
user_input[CONF_HOST] == entry.data[CONF_HOST]
|
user_input[CONF_HOST] == entry.data[CONF_HOST]
|
||||||
and user_input[CONF_PORT] == entry.data[CONF_PORT]
|
and user_input[CONF_PORT] == entry.data[CONF_PORT]
|
||||||
):
|
):
|
||||||
if self.context.get(CONF_SOURCE) == SOURCE_REAUTH:
|
if self.source == SOURCE_REAUTH:
|
||||||
self.hass.config_entries.async_update_entry(
|
return self.async_update_reload_and_abort(
|
||||||
entry, data=user_input
|
entry, data=user_input
|
||||||
)
|
)
|
||||||
await self.hass.config_entries.async_reload(entry.entry_id)
|
|
||||||
return self.async_abort(reason="reauth_successful")
|
|
||||||
return self.async_abort(reason="already_configured")
|
return self.async_abort(reason="already_configured")
|
||||||
return self.async_create_entry(
|
return self.async_create_entry(
|
||||||
title=DEFAULT_NAME,
|
title=DEFAULT_NAME,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user