From d25873f3c60126742c4f1f786d60a01a05d6bb8a Mon Sep 17 00:00:00 2001 From: Joscha Date: Sun, 21 Aug 2022 02:54:18 +0200 Subject: [PATCH] Fix auth failure popup not showing up --- src/ui/euph/room.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/ui/euph/room.rs b/src/ui/euph/room.rs index c3ef642..2d2edf9 100644 --- a/src/ui/euph/room.rs +++ b/src/ui/euph/room.rs @@ -421,6 +421,21 @@ impl EuphRoom { // we'll get an `EuphRoomEvent::Disconnected` soon after this. false } + Data::AuthReply(reply) if !reply.success => { + // Because the euphoria API is very carefully designed with + // emphasis on consistency, authentication failures are not + // normal errors but instead error-free replies that encode + // their own error. + let description = "Failed to authenticate.".to_string(); + let reason = reply + .reason + .unwrap_or_else(|| "no idea, the server wouldn't say".to_string()); + self.popups.push_front(RoomPopup::ServerError { + description, + reason, + }); + true + } _ => true, } }