Remove account on logout.

This commit is contained in:
Acrimon 2020-01-11 20:50:35 +01:00 committed by Marcel Märtens
parent 3995f099b0
commit b29e543089
2 changed files with 3 additions and 0 deletions

View File

@ -42,6 +42,8 @@ impl AuthProvider {
}
}
pub fn logout(&mut self, username: &str) { self.accounts.retain(|_, v| v != username); }
pub fn query(&mut self, username_or_token: String) -> Result<(), RegisterError> {
// Based on whether auth server is provided or not we expect an username or
// token

View File

@ -293,6 +293,7 @@ impl<'a> System<'a> for Sys {
None,
ServerMsg::broadcast(format!("{} went offline.", &player.alias)),
));
accounts.logout(&player.alias);
}
server_emitter.emit(ServerEvent::ClientDisconnect(entity));
client.postbox.send_message(ServerMsg::Disconnect);