From 6d690b0e369f4128b4c5fd183b3534574d9518f5 Mon Sep 17 00:00:00 2001 From: Shivaram Lingamneni Date: Wed, 13 Feb 2019 02:42:35 -0500 Subject: [PATCH] add loglines for account registration, login, and unregistration --- irc/accounts.go | 5 +++++ irc/handlers.go | 14 ++++++++------ irc/nickserv.go | 1 + oragono.yaml | 3 ++- 4 files changed, 16 insertions(+), 7 deletions(-) diff --git a/irc/accounts.go b/irc/accounts.go index dc08aba6..34a617d2 100644 --- a/irc/accounts.go +++ b/irc/accounts.go @@ -593,6 +593,11 @@ func (am *AccountManager) Verify(client *Client, account string, code string) er return err } + nick := "[server admin]" + if client != nil { + nick = client.Nick() + } + am.server.logger.Info("accounts", "client", nick, "registered account", casefoldedAccount) raw.Verified = true clientAccount, err := am.deserializeRawAccount(raw) if err != nil { diff --git a/irc/handlers.go b/irc/handlers.go index 7723c1ed..e6210d03 100644 --- a/irc/handlers.go +++ b/irc/handlers.go @@ -201,21 +201,23 @@ func sendSuccessfulRegResponse(client *Client, rb *ResponseBuffer, forNS bool) { // sendSuccessfulSaslAuth means that a SASL auth attempt completed successfully, and is used to dispatch messages. func sendSuccessfulSaslAuth(client *Client, rb *ResponseBuffer, forNS bool) { - account := client.AccountName() + details := client.Details() if forNS { - rb.Notice(fmt.Sprintf(client.t("You're now logged in as %s"), client.AccountName())) + rb.Notice(fmt.Sprintf(client.t("You're now logged in as %s"), details.accountName)) } else { - rb.Add(nil, client.server.name, RPL_LOGGEDIN, client.nick, client.nickMaskString, account, fmt.Sprintf(client.t("You are now logged in as %s"), account)) - rb.Add(nil, client.server.name, RPL_SASLSUCCESS, client.nick, client.t("Authentication successful")) + rb.Add(nil, client.server.name, RPL_LOGGEDIN, details.nick, details.nickMask, details.accountName, fmt.Sprintf(client.t("You are now logged in as %s"), details.accountName)) + rb.Add(nil, client.server.name, RPL_SASLSUCCESS, details.nick, client.t("Authentication successful")) } // dispatch account-notify for friend := range client.Friends(caps.AccountNotify) { - friend.Send(nil, client.nickMaskString, "ACCOUNT", account) + friend.Send(nil, details.nickMask, "ACCOUNT", details.accountName) } - client.server.snomasks.Send(sno.LocalAccounts, fmt.Sprintf(ircfmt.Unescape("Client $c[grey][$r%s$c[grey]] logged into account $c[grey][$r%s$c[grey]]"), client.nickMaskString, account)) + client.server.snomasks.Send(sno.LocalAccounts, fmt.Sprintf(ircfmt.Unescape("Client $c[grey][$r%s$c[grey]] logged into account $c[grey][$r%s$c[grey]]"), details.nickMask, details.accountName)) + + client.server.logger.Info("accounts", "client", details.nick, "logged into account", details.accountName) } // ACC VERIFY diff --git a/irc/nickserv.go b/irc/nickserv.go index eccc0464..078ce2f0 100644 --- a/irc/nickserv.go +++ b/irc/nickserv.go @@ -463,6 +463,7 @@ func nsUnregisterHandler(server *Server, client *Client, command string, params nsNotice(rb, client.t("Error while unregistering account")) } else { nsNotice(rb, fmt.Sprintf(client.t("Successfully unregistered account %s"), cfname)) + server.logger.Info("accounts", "client", client.Nick(), "unregistered account", cfname) } } diff --git a/oragono.yaml b/oragono.yaml index 587143a0..1c27065b 100644 --- a/oragono.yaml +++ b/oragono.yaml @@ -372,7 +372,8 @@ logging: # channels channel creation and operations # commands command calling and operations # opers oper actions, authentication, etc - # password password hashing and comparing + # services actions related to NickServ, ChanServ, etc. + # internal unexpected runtime behavior, including potential bugs # userinput raw lines sent by users # useroutput raw lines sent to users type: "* -userinput -useroutput"