move check if all passwords allow direct into pwdValidation so it will work with every code which ask for password

This commit is contained in:
einhornimmond 2021-02-26 16:34:52 +01:00 committed by Ulf Gebhardt
parent e7856ca7f9
commit e2c38c1a0f
No known key found for this signature in database
GPG Key ID: 81308EFE29ABFEBD
2 changed files with 627 additions and 623 deletions

View File

@ -51,7 +51,7 @@ Poco::JSON::Object* JsonCreateUser::handle(Poco::Dynamic::Var params)
if (password.size()) {
ErrorList errors;
if (!(ServerConfig::g_AllowUnsecureFlags & ServerConfig::UNSECURE_ALLOW_ALL_PASSWORDS) && !sm->checkPwdValidation(password, &errors)) {
if (!sm->checkPwdValidation(password, &errors)) {
Poco::JSON::Object* result = new Poco::JSON::Object;
result->set("state", "error");
result->set("msg", errors.getLastError()->getString(false));

View File

@ -589,6 +589,10 @@ void SessionManager::deleteLoginCookies(Poco::Net::HTTPServerRequest& request, P
bool SessionManager::checkPwdValidation(const std::string& pwd, ErrorList* errorReciver)
{
if ((ServerConfig::g_AllowUnsecureFlags & ServerConfig::UNSECURE_ALLOW_ALL_PASSWORDS) == ServerConfig::UNSECURE_ALLOW_ALL_PASSWORDS) {
return true;
}
if (!isValid(pwd, VALIDATE_PASSWORD)) {
errorReciver->addError(new Error("Passwort", "Bitte gebe ein gültiges Password ein mit mindestens 8 Zeichen, Groß- und Kleinbuchstaben, mindestens einer Zahl und einem Sonderzeichen (@$!%*?&+-_) ein!"));