CommonClient: forget password when disconnecting (#3641)

* 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 <57900059+NewSoupVi@users.noreply.github.com>
This commit is contained in:
qwint 2024-07-25 01:21:51 -05:00 committed by GitHub
parent f34da74012
commit 496f0e09af
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 0 deletions

View File

@ -61,6 +61,7 @@ class ClientCommandProcessor(CommandProcessor):
if address: if address:
self.ctx.server_address = None self.ctx.server_address = None
self.ctx.username = None self.ctx.username = None
self.ctx.password = None
elif not self.ctx.server_address: elif not self.ctx.server_address:
self.output("Please specify an address.") self.output("Please specify an address.")
return False return False
@ -514,6 +515,7 @@ class CommonContext:
async def shutdown(self): async def shutdown(self):
self.server_address = "" self.server_address = ""
self.username = None self.username = None
self.password = None
self.cancel_autoreconnect() self.cancel_autoreconnect()
if self.server and not self.server.socket.closed: if self.server and not self.server.socket.closed:
await self.server.socket.close() await self.server.socket.close()

View File

@ -596,6 +596,7 @@ class GameManager(App):
def connect_button_action(self, button): def connect_button_action(self, button):
self.ctx.username = None self.ctx.username = None
self.ctx.password = None
if self.ctx.server: if self.ctx.server:
async_start(self.ctx.disconnect()) async_start(self.ctx.disconnect())
else: else: