fix bugs which came with merging into master

This commit is contained in:
einhornimmond 2021-03-31 19:04:36 +02:00
parent 910e33deff
commit fa48de44af
8 changed files with 16 additions and 9 deletions

View File

@ -19,7 +19,7 @@ Poco::UInt64 JsonGetUserInfos::readOrCreateEmailVerificationCode(int user_id, mo
return emailVerificationCode->getModel()->getCode();
}
catch (Poco::Exception& ex) {
ErrorList errors;
NotificationList errors;
//printf("exception: %s\n", ex.displayText().data());
errors.addError(new ParamError("JsonGetUserInfos::readOrCreateEmailVerificationCode", "exception: ", ex.displayText()));
errors.sendErrorsAsEmail();

View File

@ -110,7 +110,7 @@ Poco::JSON::Object* JsonSendEmail::handle(Poco::Dynamic::Var params)
{
session = sm->getNewSession();
if (emailType == model::EMAIL_USER_RESET_PASSWORD) {
auto r = session->sendResetPasswordEmail(receiver_user, false);
auto r = session->sendResetPasswordEmail(receiver_user, false, receiver_user->getGroupBaseUrl());
if (1 == r) {
return stateWarning("email already sended");
}

View File

@ -123,7 +123,7 @@ Poco::JSON::Object* JsonUpdateUserInfos::handle(Poco::Dynamic::Var params)
jsonErrorsArray.add("User.password isn't string");
}
else {
ErrorList errors;
NotificationList errors;
if (!sm->checkPwdValidation(value.toString(), &errors)) {
jsonErrorsArray.add("User.password isn't valid");
jsonErrorsArray.add(errors.getErrorsArray());

View File

@ -95,7 +95,7 @@ int EmailManager::ThreadFunction()
if (mPendingEmails.empty()) return 0;
auto lm = LanguageManager::getInstance();
ErrorList errors;
NotificationList errors;
static const char* function_name = "PrepareEmailTask";
Poco::Net::SecureSMTPClientSession mailClientSession(mEmailAccount.url, mEmailAccount.port);

View File

@ -121,11 +121,16 @@ namespace controller {
std::string EmailVerificationCode::getLink()
{
std::string link = ServerConfig::g_frontend_checkEmailPath;
std::string link = mBaseUrl;
if (ServerConfig::g_frontend_checkEmailPath.size() > 1 && ServerConfig::g_frontend_checkEmailPath.data()[0] != '/') {
link += '/';
}
link += ServerConfig::g_frontend_checkEmailPath;
if (link.data()[link.size() - 1] != '/') {
link += '/';
}
link += std::to_string(getModel()->getCode());
return link;
}

View File

@ -81,7 +81,7 @@ namespace controller {
select.execute();
}
catch (Poco::Exception& ex) {
ErrorList errors;
NotificationList errors;
errors.addError(new ParamError(functionName, "mysql error ", ex.displayText()));
errors.addError(new ParamError(functionName, "search string", searchString));
errors.addError(new ParamError(functionName, "account state", accountState));

View File

@ -410,6 +410,9 @@ int Session::sendResetPasswordEmail(Poco::AutoPtr<controller::User> user, bool p
else {
email_already_send = true;
}
if (baseUrl.size() > 0) {
mEmailVerificationCodeObject->setBaseUrl(baseUrl);
}
auto email_verification_model = mEmailVerificationCodeObject->getModel();
if (email_already_send) {
auto time_elapsed = Poco::DateTime() - email_verification_model->getUpdated();
@ -420,7 +423,6 @@ int Session::sendResetPasswordEmail(Poco::AutoPtr<controller::User> user, bool p
if (!frequent_resend) {
if (passphraseMemorized) {
mEmailVerificationCodeObject->setBaseUrl(baseUrl);
em->addEmail(new model::Email(mEmailVerificationCodeObject, mNewUser, model::EMAIL_USER_RESET_PASSWORD));
}
else {

View File

@ -1,7 +1,7 @@
//#include "lib/Thread.h"
//#include "UniversumLib.h"
#include "Thread.h"
#include "../lib/ErrorList.h"
#include "../lib/NotificationList.h"
namespace UniLib {
namespace lib {
@ -57,7 +57,7 @@ namespace UniLib {
void Thread::run()
{
static const char* function_name = "Thread::run";
ErrorList errors;
NotificationList errors;
//Thread* t = this;
while (true) {
try {