mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
use setBaseUrl function instead of hacking getLink function
This commit is contained in:
parent
73443e373b
commit
2d665299c7
@ -109,7 +109,7 @@ Poco::JSON::Object* JsonCreateUser::handle(Poco::Dynamic::Var params)
|
||||
emailOptInModel->sendErrorsAsEmail();
|
||||
return stateError("insert emailOptIn failed");
|
||||
}
|
||||
|
||||
emailOptIn->setBaseUrl(mServerHost + "/" + ServerConfig::g_frontend_checkEmailPath);
|
||||
em->addEmail(new model::Email(emailOptIn, user, model::Email::convertTypeFromInt(emailType)));
|
||||
|
||||
if (login_after_register && session) {
|
||||
|
||||
@ -43,7 +43,13 @@ void JsonRequestHandler::handleRequest(Poco::Net::HTTPServerRequest& request, Po
|
||||
//std::ostream& responseStream = _compressResponse ? _gzipStream : _responseStream;
|
||||
|
||||
mClientIp = request.clientAddress().host();
|
||||
|
||||
|
||||
if (request.secure()) {
|
||||
mServerHost = "https://" + request.getHost();
|
||||
}
|
||||
else {
|
||||
mServerHost = "http://" + request.getHost();
|
||||
}
|
||||
auto method = request.getMethod();
|
||||
std::istream& request_stream = request.stream();
|
||||
Poco::JSON::Object* json_result = nullptr;
|
||||
|
||||
@ -26,6 +26,7 @@ public:
|
||||
protected:
|
||||
Poco::JSON::Object* mResultJson;
|
||||
Poco::Net::IPAddress mClientIp;
|
||||
std::string mServerHost;
|
||||
Session* mSession;
|
||||
|
||||
Poco::JSON::Object* checkAndLoadSession(Poco::Dynamic::Var params, bool checkIp = false);
|
||||
|
||||
@ -105,12 +105,12 @@ Poco::JSON::Object* JsonSendEmail::handle(Poco::Dynamic::Var params)
|
||||
return stateError("invalid email");
|
||||
}
|
||||
auto receiver_user_id = receiver_user->getModel()->getID();
|
||||
|
||||
std::string checkEmailUrl = receiver_user->getGroupBaseUrl() + ServerConfig::g_frontend_checkEmailPath;
|
||||
if (emailVerificationCodeType == model::table::EMAIL_OPT_IN_RESET_PASSWORD)
|
||||
{
|
||||
session = sm->getNewSession();
|
||||
if (emailType == model::EMAIL_USER_RESET_PASSWORD) {
|
||||
auto r = session->sendResetPasswordEmail(receiver_user, true, receiver_user->getGroupBaseUrl());
|
||||
auto r = session->sendResetPasswordEmail(receiver_user, true, checkEmailUrl);
|
||||
if (1 == r) {
|
||||
return stateWarning("email already sended");
|
||||
}
|
||||
@ -120,6 +120,7 @@ Poco::JSON::Object* JsonSendEmail::handle(Poco::Dynamic::Var params)
|
||||
}
|
||||
else if (emailType == model::EMAIL_CUSTOM_TEXT) {
|
||||
auto email_verification_code_object = controller::EmailVerificationCode::loadOrCreate(receiver_user_id, model::table::EMAIL_OPT_IN_RESET_PASSWORD);
|
||||
email_verification_code_object->setBaseUrl(checkEmailUrl);
|
||||
auto email = new model::Email(email_verification_code_object, receiver_user, emailCustomText, emailCustomSubject);
|
||||
em->addEmail(email);
|
||||
}
|
||||
@ -135,6 +136,7 @@ Poco::JSON::Object* JsonSendEmail::handle(Poco::Dynamic::Var params)
|
||||
}
|
||||
|
||||
auto email_verification_code_object = controller::EmailVerificationCode::loadOrCreate(receiver_user_id, emailVerificationCodeType);
|
||||
email_verification_code_object->setBaseUrl(checkEmailUrl);
|
||||
model::Email* email = nullptr;
|
||||
if (emailType == model::EMAIL_CUSTOM_TEXT) {
|
||||
email = new model::Email(email_verification_code_object, receiver_user, emailCustomText, emailCustomSubject);
|
||||
|
||||
@ -122,9 +122,6 @@ namespace controller {
|
||||
std::string EmailVerificationCode::getLink()
|
||||
{
|
||||
std::string link = mBaseUrl;
|
||||
if (ServerConfig::g_frontend_checkEmailPath.size() > 1) {
|
||||
link = ServerConfig::g_frontend_checkEmailPath;
|
||||
}
|
||||
|
||||
if (link.data()[link.size() - 1] != '/') {
|
||||
link += '/';
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user