mirror of
https://github.com/anope/anope.git
synced 2026-06-12 19:14:47 +02:00
Restore some functionality that was removed in an earlier commit.
This commit is contained in:
@@ -65,6 +65,13 @@ module
|
||||
*/
|
||||
client = "NickServ"
|
||||
|
||||
/*
|
||||
* Requires users to give an email address when they register a nick.
|
||||
*
|
||||
* This directive defaults to "yes" and is recommended to be enabled.
|
||||
*/
|
||||
forceemail = yes
|
||||
|
||||
/*
|
||||
* Require users who change their email address to confirm they
|
||||
* own their new email.
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
Anope Version 2.1.4-git
|
||||
-----------------------
|
||||
Added the db_atheme module.
|
||||
Removed module:forceemail from the nickserv module (now always enabled).
|
||||
Removed options:seed.
|
||||
|
||||
Anope Version 2.1.3
|
||||
|
||||
+21
-2
@@ -7,8 +7,8 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Anope\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2024-03-14 21:31+0000\n"
|
||||
"PO-Revision-Date: 2024-03-14 21:31+0000\n"
|
||||
"POT-Creation-Date: 2024-03-14 22:53+0000\n"
|
||||
"PO-Revision-Date: 2024-03-14 22:54+0000\n"
|
||||
"Last-Translator: Sadie Powell <sadie@witchery.services>\n"
|
||||
"Language-Team: English\n"
|
||||
"Language: en_US\n"
|
||||
@@ -745,6 +745,9 @@ msgstr "passcode"
|
||||
msgid "password"
|
||||
msgstr "password"
|
||||
|
||||
msgid "password [email]"
|
||||
msgstr "password [email]"
|
||||
|
||||
msgid "password email"
|
||||
msgstr "password email"
|
||||
|
||||
@@ -3637,6 +3640,10 @@ msgstr "Email address"
|
||||
msgid "Email address for %s changed to %s."
|
||||
msgstr "Email address for %s changed to %s."
|
||||
|
||||
#, c-format
|
||||
msgid "Email address for %s unset."
|
||||
msgstr "Email address for %s unset."
|
||||
|
||||
#, c-format
|
||||
msgid "Email for %s is invalid."
|
||||
msgstr "Email for %s is invalid."
|
||||
@@ -7237,6 +7244,15 @@ msgstr ""
|
||||
msgid "The STATS command prints out statistics about stored nicks and memory usage."
|
||||
msgstr "The STATS command prints out statistics about stored nicks and memory usage."
|
||||
|
||||
msgid ""
|
||||
"The email parameter is optional and will set the email\n"
|
||||
"for your nick immediately. You may also wish to SET HIDE it\n"
|
||||
"after registering if it isn't the default setting already."
|
||||
msgstr ""
|
||||
"The email parameter is optional and will set the email\n"
|
||||
"for your nick immediately. You may also wish to SET HIDE it\n"
|
||||
"after registering if it isn't the default setting already."
|
||||
|
||||
#, c-format
|
||||
msgid ""
|
||||
"The %s command allows users to configure logging settings\n"
|
||||
@@ -8368,6 +8384,9 @@ msgstr "You cannot set your memo limit higher than %d."
|
||||
msgid "You cannot unassign bots while persist is set on the channel."
|
||||
msgstr "You cannot unassign bots while persist is set on the channel."
|
||||
|
||||
msgid "You cannot unset the email on this network."
|
||||
msgstr "You cannot unset the email on this network."
|
||||
|
||||
msgid "You cannot use this command."
|
||||
msgstr "You cannot use this command."
|
||||
|
||||
|
||||
@@ -227,6 +227,12 @@ public:
|
||||
email_attribute = conf->Get<const Anope::string>("email_attribute");
|
||||
this->disable_register_reason = conf->Get<const Anope::string>("disable_register_reason");
|
||||
this->disable_email_reason = conf->Get<const Anope::string>("disable_email_reason");
|
||||
|
||||
if (!email_attribute.empty())
|
||||
{
|
||||
/* Don't complain to users about how they need to update their email, we will do it for them */
|
||||
config->GetModule("nickserv")->Set("forceemail", "no");
|
||||
}
|
||||
}
|
||||
|
||||
EventReturn OnPreCommand(CommandSource &source, Command *command, std::vector<Anope::string> ¶ms) override
|
||||
|
||||
@@ -357,7 +357,7 @@ public:
|
||||
if (!modesonid.empty())
|
||||
u->SetModes(NickServ, modesonid);
|
||||
|
||||
if (u->Account()->email.empty())
|
||||
if (block->Get<bool>("forceemail", "yes") && u->Account()->email.empty())
|
||||
{
|
||||
u->SendMessage(NickServ, _("You must now supply an email for your nick.\n"
|
||||
"This email will allow you to retrieve your password in\n"
|
||||
|
||||
@@ -119,10 +119,13 @@ class CommandNSRegister final
|
||||
: public Command
|
||||
{
|
||||
public:
|
||||
CommandNSRegister(Module *creator) : Command(creator, "nickserv/register", 2, 2)
|
||||
CommandNSRegister(Module *creator) : Command(creator, "nickserv/register", 1, 2)
|
||||
{
|
||||
this->SetDesc(_("Register a nickname"));
|
||||
this->SetSyntax(_("\037password\037 \037email\037"));
|
||||
if (Config->GetModule("nickserv")->Get<bool>("forceemail", "yes"))
|
||||
this->SetSyntax(_("\037password\037 \037email\037"));
|
||||
else
|
||||
this->SetSyntax(_("\037password\037 \037[email]\037"));
|
||||
this->AllowUnregistered(true);
|
||||
}
|
||||
|
||||
@@ -132,7 +135,7 @@ public:
|
||||
Anope::string u_nick = source.GetNick();
|
||||
size_t nicklen = u_nick.length();
|
||||
Anope::string pass = params[0];
|
||||
Anope::string email = params[1];
|
||||
Anope::string email = params.size() > 1 ? params[1] : "";
|
||||
const Anope::string &nsregister = Config->GetModule(this->owner)->Get<const Anope::string>("registration");
|
||||
|
||||
if (Anope::ReadOnly)
|
||||
@@ -194,7 +197,10 @@ public:
|
||||
|
||||
unsigned int minpasslen = Config->GetModule("nickserv")->Get<unsigned>("minpasslen", "10");
|
||||
unsigned int maxpasslen = Config->GetModule("nickserv")->Get<unsigned>("maxpasslen", "50");
|
||||
if (u && Anope::CurTime < u->lastnickreg + reg_delay)
|
||||
|
||||
if (Config->GetModule("nickserv")->Get<bool>("forceemail", "yes") && email.empty())
|
||||
this->OnSyntaxError(source, "");
|
||||
else if (u && Anope::CurTime < u->lastnickreg + reg_delay)
|
||||
{
|
||||
source.Reply(_("Please wait %lu seconds before using the REGISTER command again."),
|
||||
(unsigned long)(u->lastnickreg + reg_delay) - Anope::CurTime);
|
||||
@@ -207,7 +213,7 @@ public:
|
||||
source.Reply(PASSWORD_TOO_SHORT, minpasslen);
|
||||
else if (pass.length() > maxpasslen)
|
||||
source.Reply(PASSWORD_TOO_LONG, maxpasslen);
|
||||
else if (!Mail::Validate(email))
|
||||
else if (!email.empty() && !Mail::Validate(email))
|
||||
source.Reply(MAIL_X_INVALID, email.c_str());
|
||||
else
|
||||
{
|
||||
@@ -220,7 +226,8 @@ public:
|
||||
|
||||
auto *nc = new NickCore(u_nick);
|
||||
auto *na = new NickAlias(u_nick, nc);
|
||||
nc->email = email;
|
||||
if (!email.empty())
|
||||
nc->email = email;
|
||||
nc->pass = encpass;
|
||||
|
||||
if (u)
|
||||
@@ -231,7 +238,7 @@ public:
|
||||
else
|
||||
na->last_realname = source.GetNick();
|
||||
|
||||
Log(LOG_COMMAND, source, this) << "to register " << na->nick << " (email: " << na->nc->email << ")";
|
||||
Log(LOG_COMMAND, source, this) << "to register " << na->nick << " (email: " << (!na->nc->email.empty() ? na->nc->email : "none") << ")";
|
||||
|
||||
source.Reply(_("Nickname \002%s\002 registered."), u_nick.c_str());
|
||||
if (nsregister.equals_ci("admin"))
|
||||
@@ -240,8 +247,11 @@ public:
|
||||
}
|
||||
else if (nsregister.equals_ci("mail"))
|
||||
{
|
||||
nc->Extend<bool>("UNCONFIRMED");
|
||||
SendRegmail(NULL, na, source.service);
|
||||
if (!email.empty())
|
||||
{
|
||||
nc->Extend<bool>("UNCONFIRMED");
|
||||
SendRegmail(NULL, na, source.service);
|
||||
}
|
||||
}
|
||||
|
||||
FOREACH_MOD(OnNickRegister, (source.GetUser(), na, pass));
|
||||
@@ -287,6 +297,14 @@ public:
|
||||
source.service->nick.c_str(), source.service->nick.c_str(),
|
||||
minpasslen);
|
||||
|
||||
if (!Config->GetModule("nickserv")->Get<bool>("forceemail", "yes"))
|
||||
{
|
||||
source.Reply(" ");
|
||||
source.Reply(_("The \037email\037 parameter is optional and will set the email\n"
|
||||
"for your nick immediately. You may also wish to \002SET HIDE\002 it\n"
|
||||
"after registering if it isn't the default setting already."));
|
||||
}
|
||||
|
||||
source.Reply(" ");
|
||||
source.Reply(_("This command also creates a new group for your nickname,\n"
|
||||
"that will allow you to register other nicks later sharing\n"
|
||||
|
||||
@@ -549,7 +549,7 @@ class CommandNSSetEmail
|
||||
}
|
||||
|
||||
public:
|
||||
CommandNSSetEmail(Module *creator, const Anope::string &cname = "nickserv/set/email", size_t min = 1) : Command(creator, cname, min, min + 1)
|
||||
CommandNSSetEmail(Module *creator, const Anope::string &cname = "nickserv/set/email", size_t min = 0) : Command(creator, cname, min, min + 1)
|
||||
{
|
||||
this->SetDesc(_("Associate an email address with your nickname"));
|
||||
this->SetSyntax(_("\037address\037"));
|
||||
@@ -577,12 +577,17 @@ public:
|
||||
return;
|
||||
}
|
||||
|
||||
if (param.empty() && Config->GetModule("nickserv")->Get<bool>("forceemail", "yes"))
|
||||
{
|
||||
source.Reply(_("You cannot unset the email on this network."));
|
||||
return;
|
||||
}
|
||||
else if (Config->GetModule("nickserv")->Get<bool>("secureadmins", "yes") && source.nc != nc && nc->IsServicesOper())
|
||||
{
|
||||
source.Reply(_("You may not change the email of other Services Operators."));
|
||||
return;
|
||||
}
|
||||
else if (!Mail::Validate(param))
|
||||
else if (!param.empty() && !Mail::Validate(param))
|
||||
{
|
||||
source.Reply(MAIL_X_INVALID, param.c_str());
|
||||
return;
|
||||
@@ -593,7 +598,7 @@ public:
|
||||
if (MOD_RESULT == EVENT_STOP)
|
||||
return;
|
||||
|
||||
if (Config->GetModule("nickserv")->Get<bool>("confirmemailchanges") && !source.IsServicesOper())
|
||||
if (!param.empty() && Config->GetModule("nickserv")->Get<bool>("confirmemailchanges") && !source.IsServicesOper())
|
||||
{
|
||||
if (SendConfirmMail(source.GetUser(), source.GetAccount(), source.service, param))
|
||||
{
|
||||
@@ -603,15 +608,24 @@ public:
|
||||
}
|
||||
else
|
||||
{
|
||||
Log(nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to change the email of " << nc->display << " to " << param;
|
||||
nc->email = param;
|
||||
source.Reply(_("Email address for \002%s\002 changed to \002%s\002."), nc->display.c_str(), param.c_str());
|
||||
if (!param.empty())
|
||||
{
|
||||
Log(nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to change the email of " << nc->display << " to " << param;
|
||||
nc->email = param;
|
||||
source.Reply(_("Email address for \002%s\002 changed to \002%s\002."), nc->display.c_str(), param.c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
Log(nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to unset the email of " << nc->display;
|
||||
nc->email.clear();
|
||||
source.Reply(_("Email address for \002%s\002 unset."), nc->display.c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override
|
||||
{
|
||||
this->Run(source, source.nc->display, params[0]);
|
||||
this->Run(source, source.nc->display, params.size() ? params[0] : "");
|
||||
}
|
||||
|
||||
bool OnHelp(CommandSource &source, const Anope::string &) override
|
||||
@@ -637,7 +651,7 @@ public:
|
||||
|
||||
void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override
|
||||
{
|
||||
this->Run(source, params[0], params[1]);
|
||||
this->Run(source, params[0], params.size() > 1 ? params[1] : "");
|
||||
}
|
||||
|
||||
bool OnHelp(CommandSource &source, const Anope::string &) override
|
||||
|
||||
@@ -13,6 +13,9 @@ bool WebCPanel::Register::OnRequest(HTTPProvider *server, const Anope::string &p
|
||||
|
||||
replacements["TITLE"] = page_title;
|
||||
|
||||
if (Config->GetModule("nickserv")->Get<bool>("forceemail", "yes"))
|
||||
replacements["FORCE_EMAIL"] = "yes";
|
||||
|
||||
TemplateFileServer page("register.html");
|
||||
|
||||
page.Serve(server, page_name, client, message, reply, replacements);
|
||||
|
||||
@@ -34,8 +34,16 @@
|
||||
style="margin-bottom: -1px; border-bottom-left-radius: 0; border-bottom-right-radius: 0;">
|
||||
<input type="password" name="password" class="form-control" placeholder="Password" required="required"
|
||||
style="margin-bottom: -1px; border-radius: 0;">
|
||||
|
||||
{IF EXISTS FORCE_EMAIL}
|
||||
<input type="email" name="email" class="form-control" placeholder="Email" required="required"
|
||||
style="margin-bottom: 15px; border-top-left-radius: 0; border-top-right-radius: 0;">
|
||||
{ELSE}
|
||||
<h4>Optional</h4>
|
||||
<input type="email" name="email" class="form-control" placeholder="Email"
|
||||
style="margin-bottom: 15px;">
|
||||
{END IF}
|
||||
|
||||
<button class="btn btn-lg btn-warning btn-block" type="submit">Register</button>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user