mirror of
https://github.com/Telecominfraproject/wlan-cloud-ucentralsec.git
synced 2025-10-30 02:12:32 +00:00
Refactoring namespace for OpenWifi.
This commit is contained in:
@@ -18,11 +18,9 @@ namespace OpenWifi {
|
||||
if (!ContinueProcessing(Request, Response))
|
||||
return;
|
||||
|
||||
std::cout << __LINE__ << std::endl;
|
||||
if (!IsAuthorized(Request, Response))
|
||||
return;
|
||||
|
||||
std::cout << __LINE__ << std::endl;
|
||||
if (Request.getMethod() == Poco::Net::HTTPRequest::HTTP_POST)
|
||||
DoPost(Request, Response);
|
||||
else
|
||||
@@ -31,11 +29,9 @@ namespace OpenWifi {
|
||||
|
||||
void RESTAPI_email_handler::DoPost(Poco::Net::HTTPServerRequest &Request, Poco::Net::HTTPServerResponse &Response) {
|
||||
try {
|
||||
std::cout << __LINE__ << std::endl;
|
||||
Poco::JSON::Parser parser;
|
||||
auto Obj = parser.parse(Request.stream()).extract<Poco::JSON::Object::Ptr>();
|
||||
|
||||
std::cout << __LINE__ << std::endl;
|
||||
if (Obj->has("subject") &&
|
||||
Obj->has("from") &&
|
||||
Obj->has("text") &&
|
||||
@@ -45,6 +41,10 @@ namespace OpenWifi {
|
||||
|
||||
MessageAttributes Attrs;
|
||||
|
||||
std::cout << "Recipient: " << Recipients->get(0).toString() << std::endl;
|
||||
std::cout << "Text: " << Obj->get("text").toString() << std::endl;
|
||||
std::cout << "subject: " << Obj->get("subject").toString() << std::endl;
|
||||
|
||||
Attrs[RECIPIENT_EMAIL] = Recipients->get(0).toString();
|
||||
Attrs[SUBJECT] = Obj->get("subject").toString();
|
||||
Attrs[TEXT] = Obj->get("text").toString();
|
||||
|
||||
@@ -258,6 +258,7 @@ sendemail() {
|
||||
payload="{ \"recipients\" : [ \"stephane.bourque@gmail.com\" ] , \"subject\" : \"test1\" , \"from\" : \"no-reply@arilia.com\" , \"text\" : \"This is a test from SES.\" }"
|
||||
curl ${FLAGS} -X POST "https://${OWSEC}/api/v1/email" \
|
||||
-H "Content-Type: application/json" \
|
||||
-H "Authorization: Bearer ${token}" \
|
||||
-d "$payload" > ${result_file}
|
||||
jq < ${result_file}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user