diff options
-rw-r--r-- | data/nickserv.example.conf | 6 | ||||
-rw-r--r-- | docs/Changes.conf | 1 | ||||
-rw-r--r-- | include/config.h | 4 | ||||
-rw-r--r-- | modules/commands/ns_register.cpp | 23 | ||||
-rw-r--r-- | src/config.cpp | 11 |
5 files changed, 32 insertions, 13 deletions
diff --git a/data/nickserv.example.conf b/data/nickserv.example.conf index 6b3cae487..ed6be018c 100644 --- a/data/nickserv.example.conf +++ b/data/nickserv.example.conf @@ -81,9 +81,11 @@ nickserv confirmemailchanges = no /* - * Require an e-mail to be sent to the user before they can register their nick. + * Registration confirmation setting. Set to "none" for no registration confirmation, + * "mail" for email confirmation, and "admin" to have services operators manually confirm + * every registration. Set to "disable" to completely disable all registrations. */ - #emailregistration = yes + registration = "none" /* * The default options for newly registered nicks. Note that changing these options diff --git a/docs/Changes.conf b/docs/Changes.conf index a9dd31cbf..51f8c92bd 100644 --- a/docs/Changes.conf +++ b/docs/Changes.conf @@ -2,6 +2,7 @@ Anope Version 1.9.7 ------------------- operserv:notifications removed in favor of log{} blocks options:regexengine added +nickserv:registration added, emailregistration removed. Anope Version 1.9.6 ------------------- diff --git a/include/config.h b/include/config.h index 1ec67984a..99d116daa 100644 --- a/include/config.h +++ b/include/config.h @@ -529,8 +529,8 @@ class CoreExport ServerConfig bool NSSecureAdmins; /* Services opers must be /operd on the ircd aswell */ bool NSStrictPrivileges; - /* Use email to verify new users registering */ - bool NSEmailReg; + /* Type of confirmation to use, or to disable registration completely */ + Anope::string NSRegistration; /* Core NickServ modules */ Anope::string NickCoreModules; /* Set the proper channel modes on users when they identify */ diff --git a/modules/commands/ns_register.cpp b/modules/commands/ns_register.cpp index 0ebc5dadc..6050e88fb 100644 --- a/modules/commands/ns_register.cpp +++ b/modules/commands/ns_register.cpp @@ -121,6 +121,12 @@ class CommandNSRegister : public Command return; } + if (Config->NSRegistration.equals_ci("disable")) + { + source.Reply(_("Registration is currently disabled.")); + return; + } + if (!u->HasMode(UMODE_OPER) && Config->NickRegDelay && Anope::CurTime - u->my_signon < Config->NickRegDelay) { source.Reply(_("You must have been using this nick for at least %d seconds to register."), Config->NickRegDelay); @@ -190,7 +196,12 @@ class CommandNSRegister : public Command if (enc_decrypt(na->nc->pass, tmp_pass) == 1) source.Reply(_("Your password is \002%s\002 - remember this for later use."), tmp_pass.c_str()); - if (Config->NSEmailReg) + if (Config->NSRegistration.equals_ci("admin")) + { + na->nc->SetFlag(NI_UNCONFIRMED); + source.Reply(_("All new accounts must be validated by an administrator. Please wait for your registration to be confirmed.")); + } + else if (Config->NSRegistration.equals_ci("mail")) { na->nc->SetFlag(NI_UNCONFIRMED); if (SendRegmail(u, na, source.owner)) @@ -199,7 +210,7 @@ class CommandNSRegister : public Command source.Reply(_("If you do not confirm your email address within %s your account will expire."), duration(Config->NSUnconfirmedExpire).c_str()); } } - else + else if (Config->NSRegistration.equals_ci("none")) { ircdproto->SendLogin(u); if (!Config->NoNicknameOwnership && na->nc == u->Account() && na->nc->HasFlag(NI_UNCONFIRMED) == false) @@ -261,7 +272,7 @@ class CommandNSResend : public Command void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override { - if (!Config->NSEmailReg) + if (Config->NSRegistration.equals_ci("mail")) return; User *u = source.u; @@ -290,7 +301,7 @@ class CommandNSResend : public Command bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override { - if (!Config->NSEmailReg) + if (Config->NSRegistration.equals_ci("mail")) return false; this->SendSyntax(source); @@ -302,7 +313,7 @@ class CommandNSResend : public Command void OnServHelp(CommandSource &source) anope_override { - if (Config->NSEmailReg) + if (Config->NSRegistration.equals_ci("mail")) Command::OnServHelp(source); } }; @@ -319,6 +330,8 @@ class NSRegister : public Module { this->SetAuthor("Anope"); + if (Config->NSRegistration.equals_ci("disable")) + throw ModuleException("Module will not load with nickserv:registration disabled."); } }; diff --git a/src/config.cpp b/src/config.cpp index 758bf1544..524e669fa 100644 --- a/src/config.cpp +++ b/src/config.cpp @@ -318,17 +318,17 @@ bool ValidateNotZero(ServerConfig *, const Anope::string &tag, const Anope::stri bool ValidateEmailReg(ServerConfig *config, const Anope::string &tag, const Anope::string &value, ValueItem &data) { - if (config->NSEmailReg) + if (!config->NSRegistration.equals_ci("none") && !config->NSRegistration.equals_ci("disable")) { if (value.equals_ci("unconfirmedexpire")) { if (!data.GetInteger() && dotime(data.GetValue()) <= 0) - throw ConfigException("The value for <" + tag + ":" + value + "> must be non-zero when e-mail registration are enabled!"); + throw ConfigException("The value for <" + tag + ":" + value + "> must be non-zero when e-mail or admin registration is enabled!"); } else { if (!data.GetBool()) - throw ConfigException("The value for <" + tag + ":" + value + "> must be set to yes when e-mail registrations are enabled!"); + throw ConfigException("The value for <" + tag + ":" + value + "> must be set to yes when e-mail or admin registrations is enabled!"); } } return true; @@ -366,6 +366,9 @@ bool ValidateNickServ(ServerConfig *config, const Anope::string &tag, const Anop if (data.GetValue().length() > 21) throw ConfigException("The value for <nickserv:guestnickprefix> cannot exceed 21 characters in length!"); } + else if (value.equals_ci("registration")) + if (!data.GetValue().equals_ci("none") && !data.GetValue().equals_ci("mail") && !data.GetValue().equals_ci("admin") && !data.GetValue().equals_ci("registration")) + throw ConfigException("The value for <nickserv:registration> must be one of \"none\", \"mail\", \"admin\", or \"disable\""); } return true; } @@ -1158,7 +1161,7 @@ ConfigItems::ConfigItems(ServerConfig *conf) {"options", "nonicknameownership", "no", new ValueContainerBool(&conf->NoNicknameOwnership), DT_BOOLEAN | DT_NORELOAD, NoValidation}, {"options", "regexengine", "", new ValueContainerString(&conf->RegexEngine), DT_STRING, NoValidation}, {"nickserv", "name", "", new ValueContainerString(&conf->NickServ), DT_STRING, NoValidation}, - {"nickserv", "emailregistration", "no", new ValueContainerBool(&conf->NSEmailReg), DT_BOOLEAN, NoValidation}, + {"nickserv", "registration", "none", new ValueContainerString(&conf->NSRegistration), DT_STRING, ValidateNickServ}, {"nickserv", "forceemail", "no", new ValueContainerBool(&conf->NSForceEmail), DT_BOOLEAN, ValidateEmailReg}, {"nickserv", "confirmemailchanges", "no", new ValueContainerBool(&conf->NSConfirmEmailChanges), DT_BOOLEAN, NoValidation}, {"nickserv", "defaults", "secure memosignon memoreceive", new ValueContainerString(&NSDefaults), DT_STRING, NoValidation}, |