From 4b059beb247a12726d9a471433a27a39190d583b Mon Sep 17 00:00:00 2001 From: Adam Date: Fri, 27 Sep 2013 20:07:07 -0400 Subject: Replace this silly random code generation code with something more sane looking --- modules/commands/ns_resetpass.cpp | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) (limited to 'modules/commands/ns_resetpass.cpp') 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((static_cast(max - min)) * static_cast(rand()) / 65536.0) + min]; - Anope::string subject = Language::Translate(na->nc, Config->GetBlock("mail")->Get("reset_subject").c_str()), - message = Language::Translate(na->nc, Config->GetBlock("mail")->Get("reset_message").c_str()); + message = Language::Translate(na->nc, Config->GetBlock("mail")->Get("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("networkname")); -- cgit