rename config keys from review feedback

This commit is contained in:
Shivaram Lingamneni 2020-03-16 23:25:50 -04:00
parent 851c9ef198
commit edd161ddfd
5 changed files with 15 additions and 15 deletions

View File

@ -348,11 +348,11 @@ func (am *AccountManager) Register(client *Client, account string, callbackNames
// as an account; this prevents "land-grab" situations where someone else
// registers your nick out from under you and then NS GHOSTs you
// n.b. client is nil during a SAREGISTER
// n.b. if EnforceGuestFormat, then there's no concern, because you can't
// n.b. if ForceGuestFormat, then there's no concern, because you can't
// register a guest nickname anyway, and the actual registration system
// will prevent any double-register
if client != nil && config.Accounts.NickReservation.Enabled &&
!config.Accounts.NickReservation.EnforceGuestFormat &&
!config.Accounts.NickReservation.ForceGuestFormat &&
client.NickCasefolded() != casefoldedAccount {
return errAccountMustHoldNick
}

View File

@ -131,7 +131,7 @@ func (clients *ClientManager) SetNick(client *Client, session *Session, newNick
var alwaysOn, useAccountName bool
if account != "" {
alwaysOn = persistenceEnabled(config.Accounts.Multiclient.AlwaysOn, settings.AlwaysOn)
useAccountName = alwaysOn || config.Accounts.NickReservation.EnforceAccountName
useAccountName = alwaysOn || config.Accounts.NickReservation.ForceNickEqualsAccount
}
if useAccountName {
@ -150,7 +150,7 @@ func (clients *ClientManager) SetNick(client *Client, session *Session, newNick
return "", errNickMissing
}
if account == "" && config.Accounts.NickReservation.EnforceGuestFormat {
if account == "" && config.Accounts.NickReservation.ForceGuestFormat {
newNick = strings.Replace(config.Accounts.NickReservation.GuestFormat, "*", newNick, 1)
}

View File

@ -251,12 +251,12 @@ type AccountConfig struct {
AllowCustomEnforcement bool `yaml:"allow-custom-enforcement"`
RenameTimeout time.Duration `yaml:"rename-timeout"`
// RenamePrefix is the legacy field, GuestFormat is the new version
RenamePrefix string `yaml:"rename-prefix"`
GuestFormat string `yaml:"guest-nickname-format"`
guestRegexp *regexp.Regexp
guestRegexpFolded *regexp.Regexp
EnforceGuestFormat bool `yaml:"enforce-guest-format"`
EnforceAccountName bool `yaml:"enforce-account-name"`
RenamePrefix string `yaml:"rename-prefix"`
GuestFormat string `yaml:"guest-nickname-format"`
guestRegexp *regexp.Regexp
guestRegexpFolded *regexp.Regexp
ForceGuestFormat bool `yaml:"force-guest-format"`
ForceNickEqualsAccount bool `yaml:"force-nick-equals-account"`
} `yaml:"nick-reservation"`
Multiclient MulticlientConfig
Bouncer *MulticlientConfig // # handle old name for 'multiclient'

View File

@ -610,12 +610,12 @@ func nsLoginThrottleCheck(client *Client, rb *ResponseBuffer) (success bool) {
return true
}
// if enforce-account-name is set, account name and nickname must be equal,
// if force-nick-equals-account is set, account name and nickname must be equal,
// so we need to re-NICK automatically on every login event (IDENTIFY,
// VERIFY, and a REGISTER that auto-verifies). if we can't get the nick
// then we log them out (they will be able to reattach with SASL)
func nsFixNickname(client *Client, rb *ResponseBuffer, config *Config) (success bool) {
if !config.Accounts.NickReservation.EnforceAccountName {
if !config.Accounts.NickReservation.ForceNickEqualsAccount {
return true
}
// don't need to supply a nickname, SetNick will use the account name
@ -753,7 +753,7 @@ func nsRegisterHandler(server *Server, client *Client, command string, params []
config := server.Config()
account := details.nick
if config.Accounts.NickReservation.EnforceGuestFormat {
if config.Accounts.NickReservation.ForceGuestFormat {
matches := config.Accounts.NickReservation.guestRegexp.FindStringSubmatch(account)
if matches == nil || len(matches) < 2 {
nsNotice(rb, client.t("Erroneous nickname"))

View File

@ -356,13 +356,13 @@ accounts:
# a nickname matching the guest template. a caveat: this may prevent
# users from choosing nicknames in scripts different from the guest
# nickname format.
enforce-guest-format: false
force-guest-format: false
# when enabled, forces users logged into an account to use the
# account name as their nickname. when combined with strict nickname
# enforcement, this lets users treat nicknames and account names
# as equivalent for the purpose of ban/invite/exception lists.
enforce-account-name: false
force-nick-equals-account: false
# multiclient controls whether oragono allows multiple connections to
# attach to the same client/nickname identity; this is part of the