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