1
0
mirror of https://github.com/anope/anope.git synced 2026-07-06 11:53:13 +02:00

Show passlen in PASSWORD_TOO_LONG

This commit is contained in:
Adam
2015-03-12 08:00:12 -04:00
parent 92920f5a1c
commit c5ff7c6868
3 changed files with 15 additions and 8 deletions
+1 -1
View File
@@ -74,7 +74,7 @@ namespace Language
#define MORE_OBSCURE_PASSWORD _("Please try again with a more obscure password. Passwords should be at least\n" \
"five characters long, should not be something easily guessed\n" \
"(e.g. your real name or your nick), and cannot contain the space or tab characters.")
#define PASSWORD_TOO_LONG _("Your password is too long. Please try again with a shorter password.")
#define PASSWORD_TOO_LONG _("Your password is too long. It must not exceed %u characters.")
#define NICK_NOT_REGISTERED _("Your nick isn't registered.")
#define NICK_X_NOT_REGISTERED _("Nick \002%s\002 isn't registered.")
#define NICK_X_NOT_IN_USE _("Nick \002%s\002 isn't currently in use.")
+4 -2
View File
@@ -170,6 +170,8 @@ class CommandNSRegister : public Command
}
}
unsigned int passlen = Config->GetModule("nickserv")->Get<unsigned>("passlen", "32");
if (Config->GetModule("nickserv")->Get<bool>("forceemail", "yes") && email.empty())
this->OnSyntaxError(source, "");
else if (u && Anope::CurTime < u->lastnickreg + reg_delay)
@@ -178,8 +180,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() > Config->GetModule("nickserv")->Get<unsigned>("passlen", "32"))
source.Reply(PASSWORD_TOO_LONG);
else if (pass.length() > passlen)
source.Reply(PASSWORD_TOO_LONG, passlen);
else if (!email.empty() && !Mail::Validate(email))
source.Reply(MAIL_X_INVALID, email.c_str());
else
+10 -5
View File
@@ -133,9 +133,11 @@ class CommandNSSetPassword : public Command
source.Reply(MORE_OBSCURE_PASSWORD);
return;
}
else if (len > Config->GetModule("nickserv")->Get<unsigned>("passlen", "32"))
unsigned int passlen = Config->GetModule("nickserv")->Get<unsigned>("passlen", "32");
if (len > passlen)
{
source.Reply(PASSWORD_TOO_LONG);
source.Reply(PASSWORD_TOO_LONG, passlen);
return;
}
@@ -191,14 +193,17 @@ class CommandNSSASetPassword : public Command
source.Reply(_("You may not change the password of other Services Operators."));
return;
}
else if (nc->display.equals_ci(params[1]) || (Config->GetBlock("options")->Get<bool>("strictpasswords") && len < 5))
if (nc->display.equals_ci(params[1]) || (Config->GetBlock("options")->Get<bool>("strictpasswords") && len < 5))
{
source.Reply(MORE_OBSCURE_PASSWORD);
return;
}
else if (len > Config->GetModule("nickserv")->Get<unsigned>("passlen", "32"))
unsigned int passlen = Config->GetModule("nickserv")->Get<unsigned>("passlen", "32");
if (len > passlen)
{
source.Reply(PASSWORD_TOO_LONG);
source.Reply(PASSWORD_TOO_LONG, passlen);
return;
}