mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
Merge pull request #635 from gradido/login_fix_email
Change timeout for email resend to 10 Minutes
This commit is contained in:
commit
a08113eea7
@ -115,7 +115,7 @@ Poco::JSON::Object* JsonSendEmail::handle(Poco::Dynamic::Var params)
|
|||||||
return stateWarning("email already sended");
|
return stateWarning("email already sended");
|
||||||
}
|
}
|
||||||
else if (2 == r) {
|
else if (2 == r) {
|
||||||
return stateError("email already send less than a hour before");
|
return stateError("email already sent less than a 10 minutes before");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (emailType == model::EMAIL_CUSTOM_TEXT) {
|
else if (emailType == model::EMAIL_CUSTOM_TEXT) {
|
||||||
|
|||||||
@ -36,6 +36,10 @@ JsonRequestReturn JsonRequest::request(const char* methodName, const Poco::JSON:
|
|||||||
// send post request via https
|
// send post request via https
|
||||||
// 443 = HTTPS Default
|
// 443 = HTTPS Default
|
||||||
// TODO: adding port into ServerConfig
|
// TODO: adding port into ServerConfig
|
||||||
|
if (mServerHost.empty() || !mServerPort) {
|
||||||
|
addError(new Error(functionName, "server host or server port not given"));
|
||||||
|
return JSON_REQUEST_PARAMETER_ERROR;
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
Profiler phpRequestTime;
|
Profiler phpRequestTime;
|
||||||
|
|
||||||
|
|||||||
@ -20,6 +20,7 @@ enum JsonRequestReturn
|
|||||||
JSON_REQUEST_RETURN_OK,
|
JSON_REQUEST_RETURN_OK,
|
||||||
JSON_REQUEST_RETURN_PARSE_ERROR,
|
JSON_REQUEST_RETURN_PARSE_ERROR,
|
||||||
JSON_REQUEST_RETURN_ERROR,
|
JSON_REQUEST_RETURN_ERROR,
|
||||||
|
JSON_REQUEST_PARAMETER_ERROR,
|
||||||
JSON_REQUEST_CONNECT_ERROR
|
JSON_REQUEST_CONNECT_ERROR
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -425,7 +425,7 @@ int Session::sendResetPasswordEmail(Poco::AutoPtr<controller::User> user, bool p
|
|||||||
auto email_verification_model = mEmailVerificationCodeObject->getModel();
|
auto email_verification_model = mEmailVerificationCodeObject->getModel();
|
||||||
if (email_already_send) {
|
if (email_already_send) {
|
||||||
auto time_elapsed = Poco::DateTime() - email_verification_model->getUpdated();
|
auto time_elapsed = Poco::DateTime() - email_verification_model->getUpdated();
|
||||||
if (time_elapsed.totalHours() < 1) {
|
if (time_elapsed.totalMinutes() < 10) {
|
||||||
frequent_resend = true;
|
frequent_resend = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,51 @@
|
|||||||
|
#include "TestJsonCreateTransaction.h"
|
||||||
|
|
||||||
|
#include "JSONInterface/JsonCreateTransaction.h"
|
||||||
|
|
||||||
|
void TestJsonCreateTransaction::SetUp()
|
||||||
|
{
|
||||||
|
auto sm = SessionManager::getInstance();
|
||||||
|
//sm->init();
|
||||||
|
mUserSession = sm->getNewSession();
|
||||||
|
auto user = controller::User::create();
|
||||||
|
user->load("Jeet_bb@gmail.com");
|
||||||
|
user->login("TestP4ssword&H");
|
||||||
|
mUserSession->setUser(user);
|
||||||
|
}
|
||||||
|
|
||||||
|
void TestJsonCreateTransaction::TearDown()
|
||||||
|
{
|
||||||
|
auto sm = SessionManager::getInstance();
|
||||||
|
if (!mUserSession) {
|
||||||
|
sm->releaseSession(mUserSession);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Poco::JSON::Object::Ptr TestJsonCreateTransaction::basisSetup()
|
||||||
|
{
|
||||||
|
Poco::JSON::Object::Ptr params = new Poco::JSON::Object;
|
||||||
|
params->set("session_id", mUserSession->getHandle());
|
||||||
|
params->set("blockchain_type", "mysql");
|
||||||
|
params->set("memo", "Placolder for memo for test");
|
||||||
|
params->set("auto_sign", true);
|
||||||
|
|
||||||
|
return params;
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(TestJsonCreateTransaction, Creation)
|
||||||
|
{
|
||||||
|
JsonCreateTransaction jsonCall;
|
||||||
|
|
||||||
|
auto params = basisSetup();
|
||||||
|
params->set("transaction_type", "creation");
|
||||||
|
params->set("target_email", "Elfenhausen@arcor.de");
|
||||||
|
params->set("amount", 10000000);
|
||||||
|
params->set("target_date", "2021-07-13T13:00:00");
|
||||||
|
|
||||||
|
auto result = jsonCall.handle(params);
|
||||||
|
std::stringstream ss;
|
||||||
|
result->stringify(ss);
|
||||||
|
printf("result: %s\n", ss.str().data());
|
||||||
|
//*/
|
||||||
|
}
|
||||||
@ -0,0 +1,23 @@
|
|||||||
|
#ifndef __GRADIDO_LOGIN_SERVER_TEST_JSON_INTERFACE_TEST_JSON_CREATE_TRANSACTION_H
|
||||||
|
#define __GRADIDO_LOGIN_SERVER_TEST_JSON_INTERFACE_TEST_JSON_CREATE_TRANSACTION_H
|
||||||
|
|
||||||
|
#include "gtest/gtest.h"
|
||||||
|
#include "SingletonManager/SessionManager.h"
|
||||||
|
|
||||||
|
#include "Poco/JSON/Object.h"
|
||||||
|
|
||||||
|
class TestJsonCreateTransaction : public ::testing::Test
|
||||||
|
{
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void SetUp() override;
|
||||||
|
void TearDown() override;
|
||||||
|
|
||||||
|
Poco::JSON::Object::Ptr basisSetup();
|
||||||
|
|
||||||
|
Session* mUserSession;
|
||||||
|
std::string mEmail;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif //__GRADIDO_LOGIN_SERVER_TEST_JSON_INTERFACE_TEST_JSON_CREATE_TRANSACTION_H
|
||||||
Loading…
x
Reference in New Issue
Block a user