mirror of
https://github.com/anope/anope.git
synced 2026-06-12 19:14:47 +02:00
Make the length of confirmation codes configurable.
This commit is contained in:
@@ -479,6 +479,14 @@ options
|
||||
*/
|
||||
didyoumeandifference = 4
|
||||
|
||||
/*
|
||||
* The length of codes used for confirming actions like dropping a channel or a
|
||||
* nickname.
|
||||
*
|
||||
* Defaults to 15 if not set.
|
||||
*/
|
||||
codelength = 15
|
||||
|
||||
/*
|
||||
* If set, the maximum number of bytes after which to wrap services messages. This
|
||||
* can be set a bit higher than the default but should be well under the maximum
|
||||
|
||||
@@ -55,7 +55,7 @@ public:
|
||||
if (!code)
|
||||
{
|
||||
code = ci->Extend<Anope::string>("channel-dropcode");
|
||||
*code = Anope::Random(15);
|
||||
*code = Anope::Random(Config->GetBlock("options").Get<size_t>("codelength", 15));
|
||||
}
|
||||
|
||||
source.Reply(CONFIRM_DROP, ci->name.c_str(), source.service->GetQueryCommand().c_str(),
|
||||
|
||||
@@ -69,7 +69,7 @@ public:
|
||||
if (!code)
|
||||
{
|
||||
code = na->Extend<Anope::string>("nickname-dropcode");
|
||||
*code = Anope::Random(15);
|
||||
*code = Anope::Random(Config->GetBlock("options").Get<size_t>("codelength", 15));
|
||||
}
|
||||
|
||||
source.Reply(CONFIRM_DROP, na->nick.c_str(), source.service->GetQueryCommand().c_str(),
|
||||
|
||||
@@ -425,7 +425,7 @@ static bool SendRegmail(User *u, const NickAlias *na, BotInfo *bi)
|
||||
if (code == NULL)
|
||||
{
|
||||
code = na->nc->Extend<Anope::string>("passcode");
|
||||
*code = Anope::Random(15);
|
||||
*code = Anope::Random(Config->GetBlock("options").Get<size_t>("codelength", 15));
|
||||
}
|
||||
|
||||
Anope::string subject = Language::Translate(na->nc, Config->GetBlock("mail").Get<const Anope::string>("registration_subject").c_str()),
|
||||
|
||||
@@ -134,7 +134,7 @@ static bool SendResetEmail(User *u, const NickAlias *na, BotInfo *bi)
|
||||
{
|
||||
Anope::string subject = Language::Translate(na->nc, Config->GetBlock("mail").Get<const Anope::string>("reset_subject").c_str()),
|
||||
message = Language::Translate(na->nc, Config->GetBlock("mail").Get<const Anope::string>("reset_message").c_str()),
|
||||
passcode = Anope::Random(20);
|
||||
passcode = Anope::Random(Config->GetBlock("options").Get<size_t>("codelength", 15));
|
||||
|
||||
subject = subject.replace_all_cs("%n", na->nick);
|
||||
subject = subject.replace_all_cs("%N", Config->GetBlock("networkinfo").Get<const Anope::string>("networkname"));
|
||||
|
||||
@@ -520,7 +520,7 @@ class CommandNSSetEmail
|
||||
{
|
||||
static bool SendConfirmMail(User *u, NickCore *nc, BotInfo *bi, const Anope::string &new_email)
|
||||
{
|
||||
Anope::string code = Anope::Random(15);
|
||||
Anope::string code = Anope::Random(Config->GetBlock("options").Get<size_t>("codelength", 15));
|
||||
|
||||
std::pair<Anope::string, Anope::string> *n = nc->Extend<std::pair<Anope::string, Anope::string> >("ns_set_email");
|
||||
n->first = new_email;
|
||||
|
||||
Reference in New Issue
Block a user