mirror of
https://github.com/ergochat/ergo.git
synced 2025-06-12 17:57:39 +02:00
commit
7d4f5e4adf
@ -522,7 +522,7 @@ accounts:
|
||||
# 1. these nicknames cannot be registered or reserved
|
||||
# 2. if a client is automatically renamed by the server,
|
||||
# this is the template that will be used (e.g., Guest-nccj6rgmt97cg)
|
||||
# 3. if enforce-guest-format (see below) is enabled, clients without
|
||||
# 3. if force-guest-format (see below) is enabled, clients without
|
||||
# a registered account will have this template applied to their
|
||||
# nicknames (e.g., 'katie' will become 'Guest-katie')
|
||||
guest-nickname-format: "Guest-*"
|
||||
|
@ -2907,11 +2907,23 @@ func quitHandler(server *Server, client *Client, msg ircmsg.Message, rb *Respons
|
||||
|
||||
// REGISTER < account | * > < email | * > <password>
|
||||
func registerHandler(server *Server, client *Client, msg ircmsg.Message, rb *ResponseBuffer) (exiting bool) {
|
||||
accountName := client.Nick()
|
||||
if accountName == "*" {
|
||||
var accountName string
|
||||
if client.registered {
|
||||
accountName = client.Nick()
|
||||
} else {
|
||||
accountName = client.preregNick
|
||||
}
|
||||
|
||||
config := server.Config()
|
||||
if client.registered && config.Accounts.NickReservation.ForceGuestFormat {
|
||||
matches := config.Accounts.NickReservation.guestRegexp.FindStringSubmatch(accountName)
|
||||
if matches == nil || len(matches) < 2 {
|
||||
rb.Add(nil, server.name, "FAIL", "REGISTER", "INVALID_USERNAME", utils.SafeErrorParam(accountName), client.t("Username invalid or not given"))
|
||||
return
|
||||
}
|
||||
accountName = matches[1]
|
||||
}
|
||||
|
||||
switch msg.Params[0] {
|
||||
case "*", accountName:
|
||||
// ok
|
||||
@ -2928,7 +2940,6 @@ func registerHandler(server *Server, client *Client, msg ircmsg.Message, rb *Res
|
||||
return
|
||||
}
|
||||
|
||||
config := server.Config()
|
||||
if !config.Accounts.Registration.Enabled {
|
||||
rb.Add(nil, server.name, "FAIL", "REGISTER", "DISALLOWED", accountName, client.t("Account registration is disabled"))
|
||||
return
|
||||
|
@ -494,7 +494,7 @@ accounts:
|
||||
# 1. these nicknames cannot be registered or reserved
|
||||
# 2. if a client is automatically renamed by the server,
|
||||
# this is the template that will be used (e.g., Guest-nccj6rgmt97cg)
|
||||
# 3. if enforce-guest-format (see below) is enabled, clients without
|
||||
# 3. if force-guest-format (see below) is enabled, clients without
|
||||
# a registered account will have this template applied to their
|
||||
# nicknames (e.g., 'katie' will become 'Guest-katie')
|
||||
guest-nickname-format: "Guest-*"
|
||||
|
Loading…
x
Reference in New Issue
Block a user