summaryrefslogtreecommitdiff
path: root/modules/commands/ns_register.cpp
diff options
context:
space:
mode:
authorSadie Powell <sadie@witchery.services>2021-05-31 21:16:06 +0100
committerSadie Powell <sadie@witchery.services>2021-05-31 21:16:06 +0100
commitb6665d5eb952b94a12b6630f0da45955bfac0549 (patch)
tree11a0e857c36a26cc6566e65d7dd7735438bd432a /modules/commands/ns_register.cpp
parent95955ae0693310a4f70aa885a1772a021ad1a213 (diff)
Add the nickserv:minpasslen option.
Diffstat (limited to 'modules/commands/ns_register.cpp')
-rw-r--r--modules/commands/ns_register.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/modules/commands/ns_register.cpp b/modules/commands/ns_register.cpp
index bf59ad1d0..bdbff9386 100644
--- a/modules/commands/ns_register.cpp
+++ b/modules/commands/ns_register.cpp
@@ -192,6 +192,7 @@ class CommandNSRegister : public Command
}
}
+ unsigned int minpasslen = Config->GetModule("nickserv")->Get<unsigned>("minpasslen", "8");
unsigned int maxpasslen = Config->GetModule("nickserv")->Get<unsigned>("maxpasslen", "32");
if (Config->GetModule("nickserv")->Get<bool>("forceemail", "yes") && email.empty())
@@ -202,6 +203,8 @@ class CommandNSRegister : public Command
source.Reply(NICK_ALREADY_REGISTERED, u_nick.c_str());
else if (pass.equals_ci(u_nick) || (Config->GetBlock("options")->Get<bool>("strictpasswords") && pass.length() < 5))
source.Reply(MORE_OBSCURE_PASSWORD);
+ else if (pass.length() < minpasslen)
+ source.Reply(PASSWORD_TOO_SHORT, minpasslen);
else if (pass.length() > maxpasslen)
source.Reply(PASSWORD_TOO_LONG, maxpasslen);
else if (!email.empty() && !Mail::Validate(email))