diff --git a/octobot/community/authentication.py b/octobot/community/authentication.py index 416bab4d4..4bade9c6a 100644 --- a/octobot/community/authentication.py +++ b/octobot/community/authentication.py @@ -544,6 +544,8 @@ def _clear_bot_scoped_config(self): self.save_tradingview_email("") # also reset mqtt id to force a new mqtt id creation self._save_mqtt_device_uuid("") + # will force reconfiguring the next email + self.save_tradingview_email_confirmed(False) def clear_local_data_if_necessary(self): if constants.IS_CLOUD_ENV: @@ -744,6 +746,9 @@ def save_installed_package_urls(self, package_urls: list[str]): def save_tradingview_email(self, tradingview_email: str): self._save_value_in_config(constants.CONFIG_COMMUNITY_TRADINGVIEW_EMAIL, tradingview_email) + def save_tradingview_email_confirmed(self, confirmed: bool): + self._save_value_in_config(constants.CONFIG_COMMUNITY_TRADINGVIEW_EMAIL_CONFIRMED, confirmed) + def _save_mqtt_device_uuid(self, mqtt_uuid: str): self._save_value_in_config(constants.CONFIG_COMMUNITY_MQTT_UUID, mqtt_uuid) @@ -764,6 +769,9 @@ def _get_saved_bot_scoped_data_identifier(self) -> str: def get_saved_tradingview_email(self) -> str: return self._get_value_in_config(constants.CONFIG_COMMUNITY_TRADINGVIEW_EMAIL) + def is_tradingview_email_confirmed(self) -> bool: + return self._get_value_in_config(constants.CONFIG_COMMUNITY_TRADINGVIEW_EMAIL_CONFIRMED) is True + def _save_bot_id(self, bot_id): self._save_value_in_config(constants.CONFIG_COMMUNITY_BOT_ID, bot_id) diff --git a/octobot/community/feeds/community_mqtt_feed.py b/octobot/community/feeds/community_mqtt_feed.py index 950ad208f..365a4aae3 100644 --- a/octobot/community/feeds/community_mqtt_feed.py +++ b/octobot/community/feeds/community_mqtt_feed.py @@ -145,6 +145,7 @@ async def _config_feed_callback(self, data: dict): email_body = parsed_message["code_email"] self.logger.info(f"Received email address confirm code:\n{email_body}") self.authenticator.user_account.last_email_address_confirm_code_email_content = email_body + self.authenticator.save_tradingview_email_confirmed(True) else: self.logger.error(f"Unknown cfg message action: {action=}") if action and self._stop_on_cfg_action and self._stop_on_cfg_action.value == action: diff --git a/octobot/constants.py b/octobot/constants.py index 35fa68ca7..7e0108ad3 100644 --- a/octobot/constants.py +++ b/octobot/constants.py @@ -97,6 +97,7 @@ CONFIG_COMMUNITY_BOT_ID = "bot_id" CONFIG_COMMUNITY_MQTT_UUID = "mqtt_uuid" CONFIG_COMMUNITY_TRADINGVIEW_EMAIL = "tradingview_email" +CONFIG_COMMUNITY_TRADINGVIEW_EMAIL_CONFIRMED = "tradingview_email_confirmed" CONFIG_COMMUNITY_PACKAGE_URLS = "package_urls" CONFIG_COMMUNITY_ENVIRONMENT = "environment" CONFIG_COMMUNITY_LOCAL_DATA_IDENTIFIER = "local_data_identifier"