diff --git a/configs/login_server/grd_login.properties b/configs/login_server/grd_login.properties index f14568a16..96b0ea928 100644 --- a/configs/login_server/grd_login.properties +++ b/configs/login_server/grd_login.properties @@ -22,7 +22,8 @@ loginServer.db.user = root loginServer.db.password = loginServer.db.port = 3306 -frontend.checkEmailPath = http://localhost/reset +frontend.checkEmailPath = vue/checkEmail +frontend.resetPasswordPath = vue/reset email.disable = true diff --git a/login_server/src/cpp/JSONInterface/JsonSendEmail.cpp b/login_server/src/cpp/JSONInterface/JsonSendEmail.cpp index f278c393f..281c55c51 100644 --- a/login_server/src/cpp/JSONInterface/JsonSendEmail.cpp +++ b/login_server/src/cpp/JSONInterface/JsonSendEmail.cpp @@ -105,12 +105,13 @@ Poco::JSON::Object* JsonSendEmail::handle(Poco::Dynamic::Var params) return stateSuccess(); } auto receiver_user_id = receiver_user->getModel()->getID(); - std::string checkEmailUrl = receiver_user->getGroupBaseUrl() + ServerConfig::g_frontend_checkEmailPath; + std::string linkInEmail = ""; if (emailVerificationCodeType == model::table::EMAIL_OPT_IN_RESET_PASSWORD) { + linkInEmail = receiver_user->getGroupBaseUrl() + ServerConfig::g_frontend_resetPasswordPath; session = sm->getNewSession(); if (emailType == model::EMAIL_USER_RESET_PASSWORD) { - auto r = session->sendResetPasswordEmail(receiver_user, true, checkEmailUrl); + auto r = session->sendResetPasswordEmail(receiver_user, true, linkInEmail); if (1 == r) { return stateWarning("email already sended"); } @@ -120,7 +121,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); + email_verification_code_object->setBaseUrl(linkInEmail); auto email = new model::Email(email_verification_code_object, receiver_user, emailCustomText, emailCustomSubject); em->addEmail(email); } @@ -131,12 +132,13 @@ Poco::JSON::Object* JsonSendEmail::handle(Poco::Dynamic::Var params) } else { + linkInEmail = receiver_user->getGroupBaseUrl() + ServerConfig::g_frontend_checkEmailPath; if (session->getNewUser()->getModel()->getRole() != model::table::ROLE_ADMIN) { return stateError("admin needed"); } auto email_verification_code_object = controller::EmailVerificationCode::loadOrCreate(receiver_user_id, emailVerificationCodeType); - email_verification_code_object->setBaseUrl(checkEmailUrl); + email_verification_code_object->setBaseUrl(linkInEmail); model::Email* email = nullptr; if (emailType == model::EMAIL_CUSTOM_TEXT) { email = new model::Email(email_verification_code_object, receiver_user, emailCustomText, emailCustomSubject); diff --git a/login_server/src/cpp/ServerConfig.cpp b/login_server/src/cpp/ServerConfig.cpp index a453cc956..81a7b2511 100644 --- a/login_server/src/cpp/ServerConfig.cpp +++ b/login_server/src/cpp/ServerConfig.cpp @@ -51,6 +51,7 @@ namespace ServerConfig { std::string g_php_serverPath; std::string g_php_serverHost; std::string g_frontend_checkEmailPath; + std::string g_frontend_resetPasswordPath; int g_phpServerPort; Poco::Mutex g_TimeMutex; int g_FakeLoginSleepTime = 820; @@ -238,8 +239,9 @@ namespace ServerConfig { if ("" != app_secret_string) { g_CryptoAppSecret = DataTypeConverter::hexToBin(app_secret_string); } - std::string defaultCheckEmailPath = g_serverPath + "/checkEmail"; + std::string defaultCheckEmailPath = "/account/checkEmail"; g_frontend_checkEmailPath = cfg.getString("frontend.checkEmailPath", defaultCheckEmailPath); + g_frontend_resetPasswordPath = cfg.getString("frontend.resetPasswordPath", defaultCheckEmailPath); //g_CryptoAppSecret // unsecure flags diff --git a/login_server/src/cpp/ServerConfig.h b/login_server/src/cpp/ServerConfig.h index 5608a638e..a5d4a7a38 100644 --- a/login_server/src/cpp/ServerConfig.h +++ b/login_server/src/cpp/ServerConfig.h @@ -67,6 +67,7 @@ namespace ServerConfig { extern std::string g_php_serverPath; extern std::string g_php_serverHost; extern std::string g_frontend_checkEmailPath; + extern std::string g_frontend_resetPasswordPath; extern int g_phpServerPort; extern Poco::Mutex g_TimeMutex; extern int g_FakeLoginSleepTime;