mirror of
https://github.com/inspircd/inspircd.git
synced 2025-03-09 18:49:03 -04:00
Allow requiring users to be logged into their nick for requireaccount.
This commit is contained in:
parent
3d660b8e49
commit
101e12833d
@ -339,6 +339,8 @@
|
||||
# NOTE: You must complete the signon prior to full connection. Currently,
|
||||
# this is only possible by using SASL authentication; passforward
|
||||
# and PRIVMSG NickServ happen after your final connect block has been found.
|
||||
# You can also set this to "nick" to require that users are logged into their
|
||||
# current nickname.
|
||||
# Requires the account module to be loaded.
|
||||
#requireaccount="yes"
|
||||
|
||||
|
@ -340,10 +340,22 @@ public:
|
||||
|
||||
ModResult OnSetConnectClass(LocalUser* user, ConnectClass::Ptr myclass) override
|
||||
{
|
||||
if (myclass->config->getBool("requireaccount") && !accountapi.GetAccountName(user))
|
||||
const char* error = nullptr;
|
||||
if (stdalgo::string::equalsci(myclass->config->getString("requireaccount"), "nick"))
|
||||
{
|
||||
ServerInstance->Logs.Debug("CONNECTCLASS", "The %s connect class is not suitable as it requires the user to be logged into an account",
|
||||
myclass->GetName().c_str());
|
||||
if (!accountapi.GetAccountName(user) && !accountapi.IsIdentifiedToNick(user))
|
||||
error = "an account matching their current nickname";
|
||||
}
|
||||
else if (myclass->config->getBool("requireaccount"))
|
||||
{
|
||||
if (!accountapi.GetAccountName(user))
|
||||
error = "an account";
|
||||
}
|
||||
|
||||
if (error)
|
||||
{
|
||||
ServerInstance->Logs.Debug("CONNECTCLASS", "The %s connect class is not suitable as it requires the user to be logged into %s",
|
||||
myclass->GetName().c_str(), error);
|
||||
return MOD_RES_DENY;
|
||||
}
|
||||
return MOD_RES_PASSTHRU;
|
||||
|
Loading…
x
Reference in New Issue
Block a user