Skip to content

Commit

Permalink
Fix restore user data on restart #1334
Browse files Browse the repository at this point in the history
  • Loading branch information
mrlt8 committed Aug 29, 2024
1 parent a15e15b commit 7ea0e29
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
3 changes: 2 additions & 1 deletion app/wyze_bridge.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ def run(self, fresh_data: bool = False) -> None:

def _initialize(self, fresh_data: bool = False) -> None:
self.api.login(fresh_data=fresh_data)
WbAuth.set_email(email=self.api.creds.email, force=fresh_data)
email = self.api.creds.email or self.api.get_user().email
WbAuth.set_email(email=email, force=fresh_data)
self.mtx.setup_auth(WbAuth.api, STREAM_AUTH)
self.setup_streams()
if self.streams.total < 1:
Expand Down
6 changes: 5 additions & 1 deletion app/wyzebridge/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def set_email(cls, email: str, force: bool = False):
cls._update_credentials(email, force)

logger.info(f"[AUTH] WB_USERNAME={cls.username}")
logger.info(f"[AUTH] WB_PASSWORD={cls._pass[0]}{'*'*(len(cls._pass)-1)}")
logger.info(f"[AUTH] WB_PASSWORD={redact_password(cls._pass)}")
logger.info(f"[AUTH] WB_API={cls.api}")

@classmethod
Expand All @@ -83,4 +83,8 @@ def _update_credentials(cls, email: str, force: bool = False) -> None:
cls.api = get_credential("wb_api") or gen_api_key(email)


def redact_password(password: Optional[str]):
return f"{password[0]}{'*' * (len(password) - 1)}" if password else "NOT SET"


STREAM_AUTH: str = env_bool("STREAM_AUTH", style="original")

0 comments on commit 7ea0e29

Please sign in to comment.