summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--data/anope.example.conf8
-rw-r--r--modules/chanserv/cs_drop.cpp2
-rw-r--r--modules/nickserv/ns_drop.cpp2
-rw-r--r--modules/nickserv/ns_register.cpp2
-rw-r--r--modules/nickserv/ns_resetpass.cpp2
-rw-r--r--modules/nickserv/ns_set.cpp2
6 files changed, 13 insertions, 5 deletions
diff --git a/data/anope.example.conf b/data/anope.example.conf
index 21f245272..4eb10e7f2 100644
--- a/data/anope.example.conf
+++ b/data/anope.example.conf
@@ -480,6 +480,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
* message length imposed by your IRC server or messages will end up truncated.
diff --git a/modules/chanserv/cs_drop.cpp b/modules/chanserv/cs_drop.cpp
index fbde9fa5f..21e7fc44f 100644
--- a/modules/chanserv/cs_drop.cpp
+++ b/modules/chanserv/cs_drop.cpp
@@ -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(),
diff --git a/modules/nickserv/ns_drop.cpp b/modules/nickserv/ns_drop.cpp
index f2e152ce8..1f6aeaad5 100644
--- a/modules/nickserv/ns_drop.cpp
+++ b/modules/nickserv/ns_drop.cpp
@@ -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(),
diff --git a/modules/nickserv/ns_register.cpp b/modules/nickserv/ns_register.cpp
index 8222f7ad3..1f049e851 100644
--- a/modules/nickserv/ns_register.cpp
+++ b/modules/nickserv/ns_register.cpp
@@ -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()),
diff --git a/modules/nickserv/ns_resetpass.cpp b/modules/nickserv/ns_resetpass.cpp
index 52dd4e139..3eeae5052 100644
--- a/modules/nickserv/ns_resetpass.cpp
+++ b/modules/nickserv/ns_resetpass.cpp
@@ -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"));
diff --git a/modules/nickserv/ns_set.cpp b/modules/nickserv/ns_set.cpp
index b9d489ee3..63568c4f1 100644
--- a/modules/nickserv/ns_set.cpp
+++ b/modules/nickserv/ns_set.cpp
@@ -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;