Skip to content

Commit

Permalink
fix: show login failure with error page detection
Browse files Browse the repository at this point in the history
Error page was incorrectly going to action required page.
  • Loading branch information
alandtse committed Jan 2, 2021
1 parent e42018c commit 4574e00
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions custom_components/alexa_media/config_flow.py
Expand Up @@ -501,7 +501,11 @@ async def _test_login(self):
step_id="verificationcode",
data_schema=vol.Schema(self.verificationcode_schema),
)
if login.status and login.status.get("force_get"):
if (
login.status
and login.status.get("force_get")
and not login.status.get("ap_error_href")
):
_LOGGER.debug("Creating config_flow to wait for user action")
self.automatic_steps = 0
return self.async_show_form(
Expand All @@ -513,13 +517,15 @@ async def _test_login(self):
"message": f" \n>{login.status.get('message','')} \n",
},
)
if login.status and login.status.get("login_failed"):
if login.status and (
login.status.get("login_failed") or login.status.get("ap_error_href")
):
_LOGGER.debug("Login failed: %s", login.status.get("login_failed"))
await login.close()
self.hass.components.persistent_notification.async_dismiss(
"alexa_media_relogin_required"
)
return self.async_abort(reason=login.status.get("login_failed"),)
return self.async_abort(reason=login.status.get("login_failed"))
new_schema = self._update_schema_defaults()
if login.status and login.status.get("error_message"):
_LOGGER.debug("Login error detected: %s", login.status.get("error_message"))
Expand Down

0 comments on commit 4574e00

Please sign in to comment.