Replace invalid credentials with common string invalid_auth (#41997)

* add GeoNet NZ Volcano to home-assistant#40578

* move invalid_credentials

* revert geonet nz volkano

* change invalid_credentials to invalid_auth

* change translation keys
This commit is contained in:
Ronaldo Lima 2020-10-18 20:55:01 +02:00 committed by GitHub
parent 24cfca812e
commit d6d17aa295
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 7 additions and 7 deletions

View File

@ -53,7 +53,7 @@ class Life360ConfigFlow(config_entries.ConfigFlow):
except vol.Invalid: except vol.Invalid:
errors[CONF_USERNAME] = "invalid_username" errors[CONF_USERNAME] = "invalid_username"
except LoginError: except LoginError:
errors["base"] = "invalid_credentials" errors["base"] = "invalid_auth"
except Life360Error as error: except Life360Error as error:
_LOGGER.error( _LOGGER.error(
"Unexpected error communicating with Life360 server: %s", error "Unexpected error communicating with Life360 server: %s", error
@ -94,7 +94,7 @@ class Life360ConfigFlow(config_entries.ConfigFlow):
) )
except LoginError: except LoginError:
_LOGGER.error("Invalid credentials for %s", username) _LOGGER.error("Invalid credentials for %s", username)
return self.async_abort(reason="invalid_credentials") return self.async_abort(reason="invalid_auth")
except Life360Error as error: except Life360Error as error:
_LOGGER.error( _LOGGER.error(
"Unexpected error communicating with Life360 server: %s", error "Unexpected error communicating with Life360 server: %s", error

View File

@ -12,7 +12,7 @@
}, },
"error": { "error": {
"invalid_username": "Invalid username", "invalid_username": "Invalid username",
"invalid_credentials": "Invalid credentials", "invalid_auth": "[%key:common::config_flow::error::invalid_auth%]",
"user_already_configured": "[%key:common::config_flow::abort::already_configured_account%]", "user_already_configured": "[%key:common::config_flow::abort::already_configured_account%]",
"unexpected": "Unexpected error communicating with Life360 server" "unexpected": "Unexpected error communicating with Life360 server"
}, },
@ -20,7 +20,7 @@
"default": "To set advanced options, see [Life360 documentation]({docs_url})." "default": "To set advanced options, see [Life360 documentation]({docs_url})."
}, },
"abort": { "abort": {
"invalid_credentials": "Invalid credentials", "invalid_auth": "[%key:common::config_flow::error::invalid_auth%]",
"user_already_configured": "[%key:common::config_flow::abort::already_configured_account%]" "user_already_configured": "[%key:common::config_flow::abort::already_configured_account%]"
} }
} }

View File

@ -65,7 +65,7 @@ class SimpliSafeFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
LOGGER.info("Awaiting confirmation of MFA email click") LOGGER.info("Awaiting confirmation of MFA email click")
return await self.async_step_mfa() return await self.async_step_mfa()
except InvalidCredentialsError: except InvalidCredentialsError:
errors = {"base": "invalid_credentials"} errors = {"base": "invalid_auth"}
except SimplipyError as err: except SimplipyError as err:
LOGGER.error("Unknown error while logging into SimpliSafe: %s", err) LOGGER.error("Unknown error while logging into SimpliSafe: %s", err)
errors = {"base": "unknown"} errors = {"base": "unknown"}

View File

@ -23,7 +23,7 @@
}, },
"error": { "error": {
"identifier_exists": "Account already registered", "identifier_exists": "Account already registered",
"invalid_credentials": "Invalid credentials", "invalid_auth": "[%key:common::config_flow::error::invalid_auth%]",
"still_awaiting_mfa": "Still awaiting MFA email click", "still_awaiting_mfa": "Still awaiting MFA email click",
"unknown": "[%key:common::config_flow::error::unknown%]" "unknown": "[%key:common::config_flow::error::unknown%]"
}, },

View File

@ -54,7 +54,7 @@ async def test_invalid_credentials(hass):
result = await hass.config_entries.flow.async_init( result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": SOURCE_USER}, data=conf DOMAIN, context={"source": SOURCE_USER}, data=conf
) )
assert result["errors"] == {"base": "invalid_credentials"} assert result["errors"] == {"base": "invalid_auth"}
async def test_options_flow(hass): async def test_options_flow(hass):