Explorar el Código

add loglines for account registration, login, and unregistration

tags/v1.0.0-rc1
Shivaram Lingamneni hace 5 años
padre
commit
6d690b0e36
Se han modificado 4 ficheros con 16 adiciones y 7 borrados
  1. 5
    0
      irc/accounts.go
  2. 8
    6
      irc/handlers.go
  3. 1
    0
      irc/nickserv.go
  4. 2
    1
      oragono.yaml

+ 5
- 0
irc/accounts.go Ver fichero

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

+ 8
- 6
irc/handlers.go Ver fichero

@@ -201,21 +201,23 @@ func sendSuccessfulRegResponse(client *Client, rb *ResponseBuffer, forNS bool) {
201 201
 
202 202
 // sendSuccessfulSaslAuth means that a SASL auth attempt completed successfully, and is used to dispatch messages.
203 203
 func sendSuccessfulSaslAuth(client *Client, rb *ResponseBuffer, forNS bool) {
204
-	account := client.AccountName()
204
+	details := client.Details()
205 205
 
206 206
 	if forNS {
207
-		rb.Notice(fmt.Sprintf(client.t("You're now logged in as %s"), client.AccountName()))
207
+		rb.Notice(fmt.Sprintf(client.t("You're now logged in as %s"), details.accountName))
208 208
 	} else {
209
-		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))
210
-		rb.Add(nil, client.server.name, RPL_SASLSUCCESS, client.nick, client.t("Authentication successful"))
209
+		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))
210
+		rb.Add(nil, client.server.name, RPL_SASLSUCCESS, details.nick, client.t("Authentication successful"))
211 211
 	}
212 212
 
213 213
 	// dispatch account-notify
214 214
 	for friend := range client.Friends(caps.AccountNotify) {
215
-		friend.Send(nil, client.nickMaskString, "ACCOUNT", account)
215
+		friend.Send(nil, details.nickMask, "ACCOUNT", details.accountName)
216 216
 	}
217 217
 
218
-	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))
218
+	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))
219
+
220
+	client.server.logger.Info("accounts", "client", details.nick, "logged into account", details.accountName)
219 221
 }
220 222
 
221 223
 // ACC VERIFY <accountname> <auth_code>

+ 1
- 0
irc/nickserv.go Ver fichero

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

+ 2
- 1
oragono.yaml Ver fichero

@@ -372,7 +372,8 @@ logging:
372 372
         #   channels        channel creation and operations
373 373
         #   commands        command calling and operations
374 374
         #   opers           oper actions, authentication, etc
375
-        #   password        password hashing and comparing
375
+        #   services        actions related to NickServ, ChanServ, etc.
376
+        #   internal        unexpected runtime behavior, including potential bugs
376 377
         #   userinput       raw lines sent by users
377 378
         #   useroutput      raw lines sent to users
378 379
         type: "* -userinput -useroutput"

Loading…
Cancelar
Guardar