Skip to content

Commit

Permalink
CommonClient: forget password when disconnecting (#3641)
Browse files Browse the repository at this point in the history
* makes the kivy connect button do the same username forgetting that /connect does to fix an issue where losing connection would make you unable to connect to a different server

* extract duplicate code

* per request, adds handling on any disconnect to forget the saved password as to not leak it to other servers

---------

Co-authored-by: NewSoupVi <[email protected]>
  • Loading branch information
qwint and NewSoupVi committed Jul 25, 2024
1 parent f34da74 commit 496f0e0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CommonClient.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ def _cmd_connect(self, address: str = "") -> bool:
if address:
self.ctx.server_address = None
self.ctx.username = None
self.ctx.password = None
elif not self.ctx.server_address:
self.output("Please specify an address.")
return False
Expand Down Expand Up @@ -514,6 +515,7 @@ def update_permissions(self, permissions: typing.Dict[str, int]):
async def shutdown(self):
self.server_address = ""
self.username = None
self.password = None
self.cancel_autoreconnect()
if self.server and not self.server.socket.closed:
await self.server.socket.close()
Expand Down
1 change: 1 addition & 0 deletions kvui.py
Original file line number Diff line number Diff line change
Expand Up @@ -596,6 +596,7 @@ def command_button_action(self, button):

def connect_button_action(self, button):
self.ctx.username = None
self.ctx.password = None
if self.ctx.server:
async_start(self.ctx.disconnect())
else:
Expand Down

0 comments on commit 496f0e0

Please sign in to comment.