mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 19:27:45 +00:00
Make "invalid password" error message clearer (#43853)
This commit is contained in:
parent
f744f7c34e
commit
6fadc3e140
@ -124,7 +124,9 @@ async def websocket_change_password(hass, connection, msg):
|
|||||||
try:
|
try:
|
||||||
await provider.async_validate_login(username, msg["current_password"])
|
await provider.async_validate_login(username, msg["current_password"])
|
||||||
except auth_ha.InvalidAuth:
|
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
|
return
|
||||||
|
|
||||||
await provider.async_change_password(username, msg["new_password"])
|
await provider.async_change_password(username, msg["new_password"])
|
||||||
|
@ -290,7 +290,7 @@ async def test_change_password_wrong_pw(
|
|||||||
|
|
||||||
result = await client.receive_json()
|
result = await client.receive_json()
|
||||||
assert not result["success"], result
|
assert not result["success"], result
|
||||||
assert result["error"]["code"] == "invalid_password"
|
assert result["error"]["code"] == "invalid_current_password"
|
||||||
with pytest.raises(prov_ha.InvalidAuth):
|
with pytest.raises(prov_ha.InvalidAuth):
|
||||||
await auth_provider.async_validate_login("test-user", "new-pass")
|
await auth_provider.async_validate_login("test-user", "new-pass")
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user