mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
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:
parent
e7856ca7f9
commit
e2c38c1a0f
@ -51,7 +51,7 @@ Poco::JSON::Object* JsonCreateUser::handle(Poco::Dynamic::Var params)
|
|||||||
|
|
||||||
if (password.size()) {
|
if (password.size()) {
|
||||||
ErrorList errors;
|
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;
|
Poco::JSON::Object* result = new Poco::JSON::Object;
|
||||||
result->set("state", "error");
|
result->set("state", "error");
|
||||||
result->set("msg", errors.getLastError()->getString(false));
|
result->set("msg", errors.getLastError()->getString(false));
|
||||||
|
|||||||
@ -489,9 +489,9 @@ Session* SessionManager::findByEmail(const std::string& email)
|
|||||||
mDeadLockedSessionCount++;
|
mDeadLockedSessionCount++;
|
||||||
}
|
}
|
||||||
auto user = it->second->getNewUser();
|
auto user = it->second->getNewUser();
|
||||||
if (email == user->getModel()->getEmail()) {
|
if (email == user->getModel()->getEmail()) {
|
||||||
return it->second;
|
return it->second;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mWorkingMutex.unlock();
|
mWorkingMutex.unlock();
|
||||||
return nullptr;
|
return nullptr;
|
||||||
@ -504,7 +504,7 @@ void SessionManager::checkTimeoutSession()
|
|||||||
//Poco::Mutex::ScopedLock _lock(mWorkingMutex, 500);
|
//Poco::Mutex::ScopedLock _lock(mWorkingMutex, 500);
|
||||||
mWorkingMutex.tryLock(500);
|
mWorkingMutex.tryLock(500);
|
||||||
}
|
}
|
||||||
catch (Poco::TimeoutException &ex) {
|
catch (Poco::TimeoutException& ex) {
|
||||||
printf("[SessionManager::checkTimeoutSession] exception timeout mutex: %s\n", ex.displayText().data());
|
printf("[SessionManager::checkTimeoutSession] exception timeout mutex: %s\n", ex.displayText().data());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -589,6 +589,10 @@ void SessionManager::deleteLoginCookies(Poco::Net::HTTPServerRequest& request, P
|
|||||||
|
|
||||||
bool SessionManager::checkPwdValidation(const std::string& pwd, ErrorList* errorReciver)
|
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)) {
|
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!"));
|
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!"));
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user