Skip to content

Commit

Permalink
fix: fix config flow abort with failed proxy login
Browse files Browse the repository at this point in the history
Config flow only allows async abort after async_external_step_done.
  • Loading branch information
alandtse committed Jan 23, 2021
1 parent 8648cb5 commit 07c0868
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions custom_components/alexa_media/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -317,16 +317,16 @@ async def async_step_check_proxy(self, user_input=None):
)
if self.proxy:
await self.proxy.stop_proxy()
if await self.login.test_loggedin():
await self.login.finalize_login()
return self.async_external_step_done(next_step_id="finish_proxy")
return self.async_abort(reason=self.login.status.get("login_failed"))
return self.async_external_step_done(next_step_id="finish_proxy")

async def async_step_finish_proxy(self, user_input=None):
"""Finish auth."""
self.config[CONF_EMAIL] = self.login.email
self.config[CONF_PASSWORD] = self.login.password
return await self._test_login()
if await self.login.test_loggedin():
await self.login.finalize_login()
self.config[CONF_EMAIL] = self.login.email
self.config[CONF_PASSWORD] = self.login.password
return await self._test_login()
return self.async_abort(reason="login_failed")

async def async_step_user_legacy(self, user_input=None):
"""Handle legacy input for the config flow."""
Expand Down

0 comments on commit 07c0868

Please sign in to comment.