mirror of
https://github.com/Telecominfraproject/wlan-cloud-ucentralsec.git
synced 2025-11-01 11:17:51 +00:00
Debugging
This commit is contained in:
@@ -10,17 +10,19 @@
|
|||||||
namespace OpenWifi {
|
namespace OpenWifi {
|
||||||
|
|
||||||
void RESTAPI_signup_handler::DoPost() {
|
void RESTAPI_signup_handler::DoPost() {
|
||||||
|
__DBG__
|
||||||
auto UserName = GetParameter("email","");
|
auto UserName = GetParameter("email","");
|
||||||
auto signupUUID = GetParameter("signupUUID","");
|
auto signupUUID = GetParameter("signupUUID","");
|
||||||
if(UserName.empty() || signupUUID.empty()) {
|
if(UserName.empty() || signupUUID.empty()) {
|
||||||
return BadRequest(RESTAPI::Errors::MissingOrInvalidParameters);
|
return BadRequest(RESTAPI::Errors::MissingOrInvalidParameters);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
__DBG__
|
||||||
if(!Utils::ValidEMailAddress(UserName)) {
|
if(!Utils::ValidEMailAddress(UserName)) {
|
||||||
return BadRequest(RESTAPI::Errors::InvalidEmailAddress);
|
return BadRequest(RESTAPI::Errors::InvalidEmailAddress);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
__DBG__
|
||||||
// Do we already exist? Can only signup once...
|
// Do we already exist? Can only signup once...
|
||||||
SecurityObjects::UserInfo Existing;
|
SecurityObjects::UserInfo Existing;
|
||||||
if(StorageService()->SubDB().GetUserByEmail(UserName,Existing)) {
|
if(StorageService()->SubDB().GetUserByEmail(UserName,Existing)) {
|
||||||
@@ -34,6 +36,7 @@ namespace OpenWifi {
|
|||||||
|
|
||||||
return BadRequest(3, "Waiting for device:" + Existing.signingUp);
|
return BadRequest(3, "Waiting for device:" + Existing.signingUp);
|
||||||
}
|
}
|
||||||
|
__DBG__
|
||||||
|
|
||||||
SecurityObjects::UserInfo NewSub;
|
SecurityObjects::UserInfo NewSub;
|
||||||
NewSub.signingUp = signupUUID;
|
NewSub.signingUp = signupUUID;
|
||||||
@@ -45,11 +48,14 @@ namespace OpenWifi {
|
|||||||
NewSub.email = UserName;
|
NewSub.email = UserName;
|
||||||
NewSub.userRole = SecurityObjects::SUBSCRIBER;
|
NewSub.userRole = SecurityObjects::SUBSCRIBER;
|
||||||
NewSub.changePassword = true;
|
NewSub.changePassword = true;
|
||||||
|
__DBG__
|
||||||
|
|
||||||
StorageService()->SubDB().CreateRecord(NewSub);
|
StorageService()->SubDB().CreateRecord(NewSub);
|
||||||
|
__DBG__
|
||||||
|
|
||||||
Logger_.information(Poco::format("SIGNUP-PASSWORD(%s): Request for %s", Request->clientAddress().toString(), UserName));
|
Logger_.information(Poco::format("SIGNUP-PASSWORD(%s): Request for %s", Request->clientAddress().toString(), UserName));
|
||||||
SecurityObjects::ActionLink NewLink;
|
SecurityObjects::ActionLink NewLink;
|
||||||
|
__DBG__
|
||||||
|
|
||||||
NewLink.action = OpenWifi::SecurityObjects::LinkActions::SUB_SIGNUP;
|
NewLink.action = OpenWifi::SecurityObjects::LinkActions::SUB_SIGNUP;
|
||||||
NewLink.id = MicroService::CreateUUID();
|
NewLink.id = MicroService::CreateUUID();
|
||||||
@@ -58,9 +64,11 @@ namespace OpenWifi {
|
|||||||
NewLink.expires = NewLink.created + (1*60*60); // 1 hour
|
NewLink.expires = NewLink.created + (1*60*60); // 1 hour
|
||||||
NewLink.userAction = false;
|
NewLink.userAction = false;
|
||||||
StorageService()->ActionLinksDB().CreateAction(NewLink);
|
StorageService()->ActionLinksDB().CreateAction(NewLink);
|
||||||
|
__DBG__
|
||||||
|
|
||||||
Poco::JSON::Object Answer;
|
Poco::JSON::Object Answer;
|
||||||
NewSub.to_json(Answer);
|
NewSub.to_json(Answer);
|
||||||
|
__DBG__
|
||||||
return ReturnObject(Answer);
|
return ReturnObject(Answer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user