summaryrefslogtreecommitdiff
path: root/modules/commands/ns_resetpass.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'modules/commands/ns_resetpass.cpp')
-rw-r--r--modules/commands/ns_resetpass.cpp17
1 files changed, 2 insertions, 15 deletions
diff --git a/modules/commands/ns_resetpass.cpp b/modules/commands/ns_resetpass.cpp
index 4134155c4..fd0d582fb 100644
--- a/modules/commands/ns_resetpass.cpp
+++ b/modules/commands/ns_resetpass.cpp
@@ -120,22 +120,9 @@ class NSResetPass : public Module
static bool SendResetEmail(User *u, const NickAlias *na, BotInfo *bi)
{
- int min = 1, max = 62;
- int chars[] = {
- ' ', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l',
- 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x',
- 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L',
- 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y',
- 'Z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'
- };
-
- Anope::string passcode;
- int idx;
- for (idx = 0; idx < 20; ++idx)
- passcode += chars[1 + static_cast<int>((static_cast<float>(max - min)) * static_cast<uint16_t>(rand()) / 65536.0) + min];
-
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());
+ message = Language::Translate(na->nc, Config->GetBlock("mail")->Get<const Anope::string>("reset_message").c_str()),
+ passcode = Anope::Random(20);
subject = subject.replace_all_cs("%n", na->nick);
subject = subject.replace_all_cs("%N", Config->GetBlock("networkinfo")->Get<const Anope::string>("networkname"));