From f32d3f16683c70a689a2bedc3ef0aa2e85d835e9 Mon Sep 17 00:00:00 2001 From: watsonb8 Date: Fri, 15 Sep 2023 14:57:55 -0500 Subject: [PATCH] Redacting login args immediately --- commands.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/commands.go b/commands.go index 8584f2c..6f8870a 100644 --- a/commands.go +++ b/commands.go @@ -86,6 +86,12 @@ var cmdLogin = &commands.FullHandler{ } func fnLogin(ce *WrappedCommandEvent) { + if ce.Args != nil && len(ce.Args) > 0 { + _, err := ce.Bot.RedactEvent(ce.RoomID, ce.EventID) + if err != nil { + ce.User.log.Errorln("Failed to redact auth token") + } + } if ce.User.Client != nil { if ce.User.IsConnected() { ce.Reply("You're already logged in") @@ -100,8 +106,6 @@ func fnLogin(ce *WrappedCommandEvent) { return } - defer ce.Bot.RedactEvent(ce.RoomID, ce.EventID) - err := ce.User.Login(ce.Args[0]) if err != nil { ce.Reply("Failed to log in: %v", err)