فهرست منبع

fix(cloud): clear auth info if there is an error logging in

This should allow the user to start over from scratch.

Related to #2778, but does not address everything that is being requested
there, which is to be able to login to a different account while the
previous login session is still valid.
Jason Rumney 6 ماه پیش
والد
کامیت
1ad9964a8c
1فایلهای تغییر یافته به همراه2 افزوده شده و 1 حذف شده
  1. 2 1
      custom_components/tuya_local/cloud.py

+ 2 - 1
custom_components/tuya_local/cloud.py

@@ -114,7 +114,8 @@ class Cloud:
             _LOGGER.warning("Login failed: %s", info)
             self.__error_code = info.get(TUYA_RESPONSE_CODE, {})
             self.__error_msg = info.get(TUYA_RESPONSE_MSG, "Unknown error")
-
+            # Ensure expired authentication is cleared on next attempt
+            self.__hass.data[DOMAIN]["auth_cache"] = None
         return success
 
     async def async_get_devices(self) -> dict[str, Any]: