mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
Merge branch 'master' into vue_with_nginx
This commit is contained in:
commit
0ea20f2e7a
@ -209,4 +209,46 @@ return
|
|||||||
- info can contain additional info strings
|
- info can contain additional info strings
|
||||||
- user hasn't password: if user hasn't set a password yet (for example if he was registered via elopage)
|
- user hasn't password: if user hasn't set a password yet (for example if he was registered via elopage)
|
||||||
- email already activated: if email was already checked
|
- email already activated: if email was already checked
|
||||||
- session_id: session_id for new session
|
- session_id: session_id for new session
|
||||||
|
|
||||||
|
|
||||||
|
## Check Running Transactions / password encryption
|
||||||
|
Check if transactions on login-server for user are processed
|
||||||
|
|
||||||
|
GET http://localhost/login_api/getRunningUserTasks?email=max.musterman%40gmail.de
|
||||||
|
# OR
|
||||||
|
POST http://localhost/login_api/getRunningUserTasks
|
||||||
|
```json
|
||||||
|
{"email":"max.musterman@gmail.de"}
|
||||||
|
```
|
||||||
|
|
||||||
|
return
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"state":"success",
|
||||||
|
"runningTasks": {
|
||||||
|
"password creation": 0,
|
||||||
|
"sign transaction": 1,
|
||||||
|
"prepare transaction": 1,
|
||||||
|
"ready for sign transaction":0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
return only entrys which > 0
|
||||||
|
- password creation: after register or password change, login possible after tasks is finish
|
||||||
|
- sign transaction: after check transaction in backend, before transaction is in db
|
||||||
|
- prepare transaction: after sending transaction to login-server, before they can be checked
|
||||||
|
- ready for sign transaction: transactions ready for signing from user
|
||||||
|
|
||||||
|
## Check Session State
|
||||||
|
GET http://localhost/login_api/checkSessionState?session_id=-127182
|
||||||
|
|
||||||
|
return if session is still open
|
||||||
|
```json
|
||||||
|
{"state":"success"}
|
||||||
|
```
|
||||||
|
else return
|
||||||
|
```json
|
||||||
|
{"state":"not found", "msg": "session not found"}
|
||||||
|
```
|
||||||
|
|
||||||
|
|||||||
53
login_server/src/cpp/JSONInterface/JsonCheckSessionState.cpp
Normal file
53
login_server/src/cpp/JSONInterface/JsonCheckSessionState.cpp
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
#include "JsonCheckSessionState.h"
|
||||||
|
#include "Poco/URI.h"
|
||||||
|
#include "../lib/DataTypeConverter.h"
|
||||||
|
#include "../SingletonManager/SessionManager.h"
|
||||||
|
|
||||||
|
Poco::JSON::Object* JsonCheckSessionState::handle(Poco::Dynamic::Var params)
|
||||||
|
{
|
||||||
|
int session_id = 0;
|
||||||
|
|
||||||
|
bool parameterReaded = false;
|
||||||
|
// if is json object
|
||||||
|
if (params.type() == typeid(Poco::JSON::Object::Ptr)) {
|
||||||
|
Poco::JSON::Object::Ptr paramJsonObject = params.extract<Poco::JSON::Object::Ptr>();
|
||||||
|
/// Throws a RangeException if the value does not fit
|
||||||
|
/// into the result variable.
|
||||||
|
/// Throws a NotImplementedException if conversion is
|
||||||
|
/// not available for the given type.
|
||||||
|
/// Throws InvalidAccessException if Var is empty.
|
||||||
|
try {
|
||||||
|
paramJsonObject->get("session_id").convert(session_id);
|
||||||
|
parameterReaded = true;
|
||||||
|
}
|
||||||
|
catch (Poco::Exception& ex) {
|
||||||
|
return stateError("json exception", ex.displayText());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (params.isVector()) {
|
||||||
|
const Poco::URI::QueryParameters queryParams = params.extract<Poco::URI::QueryParameters>();
|
||||||
|
for (auto it = queryParams.begin(); it != queryParams.end(); it++) {
|
||||||
|
if (it->first == "session_id") {
|
||||||
|
DataTypeConverter::strToInt(it->second, session_id);
|
||||||
|
//session_id = it->second;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
parameterReaded = true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return stateError("format not implemented", std::string(params.type().name()));
|
||||||
|
}
|
||||||
|
if (!parameterReaded) {
|
||||||
|
return stateError("parameter couldn't parsed");
|
||||||
|
}
|
||||||
|
auto sm = SessionManager::getInstance();
|
||||||
|
auto session = sm->getSession(session_id);
|
||||||
|
if (session) {
|
||||||
|
return stateSuccess();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return customStateError("not found", "session not found");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
16
login_server/src/cpp/JSONInterface/JsonCheckSessionState.h
Normal file
16
login_server/src/cpp/JSONInterface/JsonCheckSessionState.h
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
#ifndef __JSON_INTERFACE_JSON_CHECK_SESSION_STATE_
|
||||||
|
#define __JSON_INTERFACE_JSON_CHECK_SESSION_STATE_
|
||||||
|
|
||||||
|
#include "JsonRequestHandler.h"
|
||||||
|
|
||||||
|
class JsonCheckSessionState : public JsonRequestHandler
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
Poco::JSON::Object* handle(Poco::Dynamic::Var params);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // __JSON_INTERFACE_JSON_CHECK_SESSION_STATE_
|
||||||
@ -4,6 +4,8 @@
|
|||||||
|
|
||||||
#include "../SingletonManager/SessionManager.h"
|
#include "../SingletonManager/SessionManager.h"
|
||||||
|
|
||||||
|
#include "JsonAdminEmailVerificationResend.h"
|
||||||
|
#include "JsonCheckSessionState.h"
|
||||||
#include "JsonCreateUser.h"
|
#include "JsonCreateUser.h"
|
||||||
#include "JsonGetLogin.h"
|
#include "JsonGetLogin.h"
|
||||||
#include "JsonUnknown.h"
|
#include "JsonUnknown.h"
|
||||||
@ -11,7 +13,6 @@
|
|||||||
#include "JsonGetRunningUserTasks.h"
|
#include "JsonGetRunningUserTasks.h"
|
||||||
#include "JsonGetUsers.h"
|
#include "JsonGetUsers.h"
|
||||||
#include "JsonLoginViaEmailVerificationCode.h"
|
#include "JsonLoginViaEmailVerificationCode.h"
|
||||||
#include "JsonAdminEmailVerificationResend.h"
|
|
||||||
#include "JsonGetUserInfos.h"
|
#include "JsonGetUserInfos.h"
|
||||||
#include "JsonUpdateUserInfos.h"
|
#include "JsonUpdateUserInfos.h"
|
||||||
#include "JsonUnsecureLogin.h"
|
#include "JsonUnsecureLogin.h"
|
||||||
@ -44,6 +45,9 @@ Poco::Net::HTTPRequestHandler* JsonRequestHandlerFactory::createRequestHandler(c
|
|||||||
if (url_first_part == "/login") {
|
if (url_first_part == "/login") {
|
||||||
return new JsonGetLogin;
|
return new JsonGetLogin;
|
||||||
}
|
}
|
||||||
|
else if (url_first_part == "/checkSessionState") {
|
||||||
|
return new JsonCheckSessionState;
|
||||||
|
}
|
||||||
else if (url_first_part == "/checkTransaction") {
|
else if (url_first_part == "/checkTransaction") {
|
||||||
return new JsonTransaction;
|
return new JsonTransaction;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user