mirror of
https://github.com/ergochat/ergo.git
synced 2024-11-15 00:19:29 +01:00
fix #1840
Account registrations pending verification should produce a logline and send a sno.
This commit is contained in:
parent
ee720f60e2
commit
9ff4047fa6
@ -474,6 +474,8 @@ func (am *AccountManager) Register(client *Client, account string, callbackNames
|
||||
am.Unregister(casefoldedAccount, true)
|
||||
return ®istrationCallbackError{underlying: err}
|
||||
} else {
|
||||
am.server.logger.Info("accounts",
|
||||
fmt.Sprintf("nickname %s registered account %s, pending verification", client.Nick(), account))
|
||||
return am.server.store.Update(func(tx *buntdb.Tx) error {
|
||||
_, _, err = tx.Set(verificationCodeKey, code, setOptions)
|
||||
return err
|
||||
|
@ -81,6 +81,10 @@ func registrationErrorToMessage(config *Config, client *Client, err error) (mess
|
||||
return
|
||||
}
|
||||
|
||||
func announcePendingReg(client *Client, rb *ResponseBuffer, accountName string) {
|
||||
client.server.snomasks.Send(sno.LocalAccounts, fmt.Sprintf(ircfmt.Unescape("Client $c[grey][$r%s$c[grey]] attempted to register account $c[grey][$r%s$c[grey]] from IP %s, pending verification"), client.Nick(), accountName, rb.session.IP().String()))
|
||||
}
|
||||
|
||||
// helper function to dispatch messages when a client successfully registers
|
||||
func sendSuccessfulRegResponse(service *ircService, client *Client, rb *ResponseBuffer) {
|
||||
details := client.Details()
|
||||
@ -2632,6 +2636,7 @@ func registerHandler(server *Server, client *Client, msg ircmsg.Message, rb *Res
|
||||
} else {
|
||||
rb.Add(nil, server.name, "REGISTER", "VERIFICATION_REQUIRED", accountName, fmt.Sprintf(client.t("Account created, pending verification; verification code has been sent to %s"), callbackValue))
|
||||
client.registerCmdSent = true
|
||||
announcePendingReg(client, rb, accountName)
|
||||
}
|
||||
case errAccountAlreadyRegistered, errAccountAlreadyUnregistered, errAccountMustHoldNick:
|
||||
rb.Add(nil, server.name, "FAIL", "REGISTER", "USERNAME_EXISTS", accountName, client.t("Username is already registered or otherwise unavailable"))
|
||||
|
@ -1004,6 +1004,7 @@ func nsRegisterHandler(service *ircService, server *Server, client *Client, comm
|
||||
messageTemplate := client.t("Account created, pending verification; verification code has been sent to %s")
|
||||
message := fmt.Sprintf(messageTemplate, callbackValue)
|
||||
service.Notice(rb, message)
|
||||
announcePendingReg(client, rb, account)
|
||||
}
|
||||
} else {
|
||||
// details could not be stored and relevant numerics have been dispatched, abort
|
||||
|
Loading…
Reference in New Issue
Block a user