3
0
mirror of https://github.com/ergochat/ergo.git synced 2024-11-23 04:19:25 +01:00

add loglines for account registration, login, and unregistration

This commit is contained in:
Shivaram Lingamneni 2019-02-13 02:42:35 -05:00
parent f40c363170
commit 6d690b0e36
4 changed files with 16 additions and 7 deletions

View File

@ -593,6 +593,11 @@ func (am *AccountManager) Verify(client *Client, account string, code string) er
return err return err
} }
nick := "[server admin]"
if client != nil {
nick = client.Nick()
}
am.server.logger.Info("accounts", "client", nick, "registered account", casefoldedAccount)
raw.Verified = true raw.Verified = true
clientAccount, err := am.deserializeRawAccount(raw) clientAccount, err := am.deserializeRawAccount(raw)
if err != nil { if err != nil {

View File

@ -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. // sendSuccessfulSaslAuth means that a SASL auth attempt completed successfully, and is used to dispatch messages.
func sendSuccessfulSaslAuth(client *Client, rb *ResponseBuffer, forNS bool) { func sendSuccessfulSaslAuth(client *Client, rb *ResponseBuffer, forNS bool) {
account := client.AccountName() details := client.Details()
if forNS { 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 { } 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_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, client.nick, client.t("Authentication successful")) rb.Add(nil, client.server.name, RPL_SASLSUCCESS, details.nick, client.t("Authentication successful"))
} }
// dispatch account-notify // dispatch account-notify
for friend := range client.Friends(caps.AccountNotify) { 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 <accountname> <auth_code> // ACC VERIFY <accountname> <auth_code>

View File

@ -463,6 +463,7 @@ func nsUnregisterHandler(server *Server, client *Client, command string, params
nsNotice(rb, client.t("Error while unregistering account")) nsNotice(rb, client.t("Error while unregistering account"))
} else { } else {
nsNotice(rb, fmt.Sprintf(client.t("Successfully unregistered account %s"), cfname)) nsNotice(rb, fmt.Sprintf(client.t("Successfully unregistered account %s"), cfname))
server.logger.Info("accounts", "client", client.Nick(), "unregistered account", cfname)
} }
} }

View File

@ -372,7 +372,8 @@ logging:
# channels channel creation and operations # channels channel creation and operations
# commands command calling and operations # commands command calling and operations
# opers oper actions, authentication, etc # 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 # userinput raw lines sent by users
# useroutput raw lines sent to users # useroutput raw lines sent to users
type: "* -userinput -useroutput" type: "* -userinput -useroutput"