little things

This commit is contained in:
einhornimmond 2021-06-17 11:59:31 +02:00
parent 53ebc4be4c
commit 2a3677f767
2 changed files with 10 additions and 6 deletions

View File

@ -42,10 +42,12 @@ Poco::JSON::Object* JsonResetPassword::handle(Poco::Dynamic::Var params)
return stateError("password encryption is already running");
}
user->setNewPassword(password);
KeyPairEd25519* key_pair = NULL;
if (!user->tryLoadPassphraseUserBackup(&key_pair)) {
user->setGradidoKeyPair(key_pair);
auto update_password_result = user->setNewPassword(password);
if (update_password_result == 2) {
KeyPairEd25519* key_pair = NULL;
if (!user->tryLoadPassphraseUserBackup(&key_pair)) {
user->setGradidoKeyPair(key_pair);
}
}
return stateSuccess();
}

View File

@ -171,8 +171,10 @@ Poco::JSON::Object* JsonUpdateUserInfos::handle(Poco::Dynamic::Var params)
if (str_val.size() > 0)
{
if (!user->hasPassword() || isOldPasswordValid(updates, jsonErrorsArray))
if (!user->hasPassword()) {
return stateError("login state invalid");
}
if (isOldPasswordValid(updates, jsonErrorsArray))
{
NotificationList errors;
if (!sm->checkPwdValidation(value.toString(), &errors, LanguageManager::getInstance()->getFreeCatalog(LANG_EN))) {