Skip to content

Commit

Permalink
Fix #79 #81 - integration setup errors caused by invalid credentials
Browse files Browse the repository at this point in the history
  • Loading branch information
elad-bar committed Sep 17, 2020
1 parent 5574fc9 commit dc3de8e
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## 2020-09-17

**Fixed bugs:**

- Integration setup errors caused by invalid credentials (User input malformed / Unknown error occurred) [\#79](https://github.com/elad-bar/ha-bleuiris/issues/79) [\#81](https://github.com/elad-bar/ha-bleuiris/issues/81)

## 2020-08-08

**Implemented enhancements:**
Expand Down
4 changes: 4 additions & 0 deletions custom_components/blueiris/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ async def async_step_user(self, user_input=None):

return self.async_create_entry(title=self._config_flow.title, data=data)
except LoginError as lex:
await self._config_flow.clear_credentials(new_user_input)

_LOGGER.warning("Cannot complete login")

errors = lex.errors
Expand Down Expand Up @@ -107,6 +109,8 @@ async def async_step_blue_iris_additional_settings(self, user_input=None):
title=self._config_flow.title, data=options
)
except LoginError as lex:
await self._config_flow.clear_credentials(user_input)

_LOGGER.warning("Cannot complete login")

errors = lex.errors
Expand Down
5 changes: 5 additions & 0 deletions custom_components/blueiris/managers/config_flow_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,11 @@ async def _update_entry(self):

await self._config_manager.update(entry)

async def clear_credentials(self, user_input):
user_input[CONF_CLEAR_CREDENTIALS] = True

await self._handle_password(user_input)

async def _handle_password(self, user_input):
if CONF_CLEAR_CREDENTIALS in user_input:
clear_credentials = user_input.get(CONF_CLEAR_CREDENTIALS)
Expand Down

0 comments on commit dc3de8e

Please sign in to comment.