mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
add path for reset password request from new frontend
This commit is contained in:
parent
cae9de0f2b
commit
b41966ee90
@ -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
|
||||
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user