mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
Merge pull request #219 from gradido/login_add_user_to_json_login
User Object on Json Login
This commit is contained in:
commit
bafe77ed10
@ -48,11 +48,36 @@ In case of success returns:
|
|||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"state":"success",
|
"state":"success",
|
||||||
|
"user": {
|
||||||
|
"created": 1614782270,
|
||||||
|
"disabled": false,
|
||||||
|
"email": "max.musterman@gmail.de",
|
||||||
|
"email_checked": true,
|
||||||
|
"first_name": "Max",
|
||||||
|
"group_alias": "gdd1",
|
||||||
|
"ident_hash": 323769895,
|
||||||
|
"last_name": "Mustermann",
|
||||||
|
"public_hex": "131c7f68dd94b2be4c913400ff7ff4cdc03ac2bda99c2d29edcacb3b065c67e6",
|
||||||
|
"role": "none",
|
||||||
|
"username": ""
|
||||||
|
}
|
||||||
"session_id": -127182,
|
"session_id": -127182,
|
||||||
"clientIP":"123.123.123.123"
|
"clientIP":"123.123.123.123"
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
- `user`: contain user object
|
||||||
|
- `created`: timestamp on which account was created
|
||||||
|
- `disabled`: true if account was disabled, if disabled no login or coin transfer is possible
|
||||||
|
- `email`: email of user
|
||||||
|
- `email_checked`: true if user has successfully clicked on activation link in email
|
||||||
|
- `first_name`: first name of user
|
||||||
|
- `group_alias`: alias of group/community to which user belong
|
||||||
|
- `ident_hash`: currently hash of email, will be later a identification hash to prevent multiple accounts and therefore multiple creations per user
|
||||||
|
- `last_name`: last name of user
|
||||||
|
- `public_hex`: public key of user in hex format
|
||||||
|
- `role`: role of user currently only "none" or "admin"
|
||||||
|
- `username`: not used yet
|
||||||
- `clientIP`: should be the same as where the js-client is running, else maybe a man-in-the-middle attacks is happening or
|
- `clientIP`: should be the same as where the js-client is running, else maybe a man-in-the-middle attacks is happening or
|
||||||
nginx was wrong configured.
|
nginx was wrong configured.
|
||||||
- `session_id`: can be also negative
|
- `session_id`: can be also negative
|
||||||
@ -265,6 +290,19 @@ In case of success returns:
|
|||||||
{
|
{
|
||||||
"state":"success", "email_verification_code_type":"resetPassword",
|
"state":"success", "email_verification_code_type":"resetPassword",
|
||||||
"info":[],
|
"info":[],
|
||||||
|
"user": {
|
||||||
|
"created": 1614782270,
|
||||||
|
"disabled": false,
|
||||||
|
"email": "max.musterman@gmail.de",
|
||||||
|
"email_checked": true,
|
||||||
|
"first_name": "Max",
|
||||||
|
"group_alias": "gdd1",
|
||||||
|
"ident_hash": 323769895,
|
||||||
|
"last_name": "Mustermann",
|
||||||
|
"public_hex": "131c7f68dd94b2be4c913400ff7ff4cdc03ac2bda99c2d29edcacb3b065c67e6",
|
||||||
|
"role": "none",
|
||||||
|
"username": ""
|
||||||
|
}
|
||||||
"session_id":1853761475
|
"session_id":1853761475
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
@ -274,8 +312,20 @@ In case of success returns:
|
|||||||
- `registerDirect`: code generated by register for check email
|
- `registerDirect`: code generated by register for check email
|
||||||
- `register`: code generated by auto-register via elopage for check email
|
- `register`: code generated by auto-register via elopage for check email
|
||||||
- `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 has no 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
|
||||||
|
- `user`: contain user object
|
||||||
|
- `created`: timestamp on which account was created
|
||||||
|
- `disabled`: true if account was disabled, if disabled no login or coin transfer is possible
|
||||||
|
- `email`: email of user
|
||||||
|
- `email_checked`: true if user has successfully clicked on activation link in email
|
||||||
|
- `first_name`: first name of user
|
||||||
|
- `group_alias`: alias of group/community to which user belong
|
||||||
|
- `ident_hash`: currently hash of email, will be later a identification hash to prevent multiple accounts and therefore multiple creations per user
|
||||||
|
- `last_name`: last name of user
|
||||||
|
- `public_hex`: public key of user in hex format
|
||||||
|
- `role`: role of user currently only "none" or "admin"
|
||||||
|
- `username`: not used yet
|
||||||
- `session_id`: session_id for new session
|
- `session_id`: session_id for new session
|
||||||
|
|
||||||
## Send E-Mails
|
## Send E-Mails
|
||||||
|
|||||||
@ -53,18 +53,20 @@ Poco::JSON::Object* JsonLoginViaEmailVerificationCode::handle(Poco::Dynamic::Var
|
|||||||
result->set("session_id", session->getHandle());
|
result->set("session_id", session->getHandle());
|
||||||
result->set("email_verification_code_type", model::table::EmailOptIn::typeToString(session->getEmailVerificationType()));
|
result->set("email_verification_code_type", model::table::EmailOptIn::typeToString(session->getEmailVerificationType()));
|
||||||
Poco::JSON::Array info;
|
Poco::JSON::Array info;
|
||||||
|
auto user = session->getNewUser();
|
||||||
if (!session->getNewUser()->getModel()->getPasswordHashed()) {
|
|
||||||
info.add("user hasn't password");
|
if (!user->getModel()->getPasswordHashed()) {
|
||||||
|
info.add("user has no password");
|
||||||
}
|
}
|
||||||
auto update_email_verification_result = session->updateEmailVerification(code);
|
auto update_email_verification_result = session->updateEmailVerification(code);
|
||||||
if (1 == update_email_verification_result) {
|
if (1 == update_email_verification_result) {
|
||||||
info.add("email already activated");
|
info.add("email already activated");
|
||||||
}
|
}
|
||||||
|
result->set("user", user->getJson());
|
||||||
|
|
||||||
result->set("info", info);
|
result->set("info", info);
|
||||||
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -102,6 +102,7 @@ Poco::JSON::Object* JsonUnsecureLogin::handle(Poco::Dynamic::Var params)
|
|||||||
case USER_COMPLETE:
|
case USER_COMPLETE:
|
||||||
case USER_EMAIL_NOT_ACTIVATED:
|
case USER_EMAIL_NOT_ACTIVATED:
|
||||||
result->set("state", "success");
|
result->set("state", "success");
|
||||||
|
result->set("user", session->getNewUser()->getJson());
|
||||||
result->set("session_id", session->getHandle());
|
result->set("session_id", session->getHandle());
|
||||||
session->setClientIp(mClientIP);
|
session->setClientIp(mClientIP);
|
||||||
return result;
|
return result;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user