1
0
mirror of https://github.com/anope/anope.git synced 2026-07-06 21:23:13 +02:00

Require new accounts to have email addresses.

This commit is contained in:
Sadie Powell
2024-03-07 21:40:52 +00:00
parent 307ffea951
commit 3272c1bbc6
8 changed files with 12 additions and 87 deletions
+8 -22
View File
@@ -542,7 +542,7 @@ class CommandNSSetEmail
}
public:
CommandNSSetEmail(Module *creator, const Anope::string &cname = "nickserv/set/email", size_t min = 0) : Command(creator, cname, min, min + 1)
CommandNSSetEmail(Module *creator, const Anope::string &cname = "nickserv/set/email", size_t min = 1) : Command(creator, cname, min, min + 1)
{
this->SetDesc(_("Associate an E-mail address with your nickname"));
this->SetSyntax(_("\037address\037"));
@@ -570,17 +570,12 @@ public:
return;
}
if (param.empty() && Config->GetModule("nickserv")->Get<bool>("forceemail", "yes"))
{
source.Reply(_("You cannot unset the e-mail 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 e-mail of other Services Operators."));
return;
}
else if (!param.empty() && !Mail::Validate(param))
else if (!Mail::Validate(param))
{
source.Reply(MAIL_X_INVALID, param.c_str());
return;
@@ -591,7 +586,7 @@ public:
if (MOD_RESULT == EVENT_STOP)
return;
if (!param.empty() && Config->GetModule("nickserv")->Get<bool>("confirmemailchanges") && !source.IsServicesOper())
if (Config->GetModule("nickserv")->Get<bool>("confirmemailchanges") && !source.IsServicesOper())
{
if (SendConfirmMail(source.GetUser(), source.GetAccount(), source.service, param))
{
@@ -601,24 +596,15 @@ public:
}
else
{
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(_("E-mail 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(_("E-mail address for \002%s\002 unset."), nc->display.c_str());
}
Log(nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to change the email of " << nc->display << " to " << param;
nc->email = param;
source.Reply(_("E-mail address for \002%s\002 changed to \002%s\002."), nc->display.c_str(), param.c_str());
}
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params) override
{
this->Run(source, source.nc->display, params.size() ? params[0] : "");
this->Run(source, source.nc->display, params[0]);
}
bool OnHelp(CommandSource &source, const Anope::string &) override
@@ -644,7 +630,7 @@ public:
void Execute(CommandSource &source, const std::vector<Anope::string> &params) override
{
this->Run(source, params[0], params.size() > 1 ? params[1] : "");
this->Run(source, params[0], params[1]);
}
bool OnHelp(CommandSource &source, const Anope::string &) override