Make "invalid password" error message clearer (#43853)

This commit is contained in:
Philip Allgaier 2020-12-02 14:24:47 +01:00 committed by GitHub
parent f744f7c34e
commit 6fadc3e140
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

View File

@ -124,7 +124,9 @@ async def websocket_change_password(hass, connection, msg):
try:
await provider.async_validate_login(username, msg["current_password"])
except auth_ha.InvalidAuth:
connection.send_error(msg["id"], "invalid_password", "Invalid password")
connection.send_error(
msg["id"], "invalid_current_password", "Invalid current password"
)
return
await provider.async_change_password(username, msg["new_password"])

View File

@ -290,7 +290,7 @@ async def test_change_password_wrong_pw(
result = await client.receive_json()
assert not result["success"], result
assert result["error"]["code"] == "invalid_password"
assert result["error"]["code"] == "invalid_current_password"
with pytest.raises(prov_ha.InvalidAuth):
await auth_provider.async_validate_login("test-user", "new-pass")