diff --git a/build b/build index 43c451e..7c6ba0f 100644 --- a/build +++ b/build @@ -1 +1 @@ -54 \ No newline at end of file +55 \ No newline at end of file diff --git a/src/RESTAPI/RESTAPI_oauth2_handler.cpp b/src/RESTAPI/RESTAPI_oauth2_handler.cpp index 1472923..c3ac610 100644 --- a/src/RESTAPI/RESTAPI_oauth2_handler.cpp +++ b/src/RESTAPI/RESTAPI_oauth2_handler.cpp @@ -37,21 +37,12 @@ namespace OpenWifi { } void RESTAPI_oauth2_handler::DoDelete() { - bool Expired = false, Contacted=false; - if (!IsAuthorized(Expired, Contacted)) { - if(Expired) - return UnAuthorized(RESTAPI::Errors::EXPIRED_TOKEN); - return UnAuthorized(RESTAPI::Errors::INVALID_TOKEN); - } - - auto Token = GetBinding(RESTAPI::Protocol::TOKEN, "..."); - if (Token == SessionToken_) { - AuthService()->Logout(Token); - return ReturnStatus(Poco::Net::HTTPResponse::HTTP_NO_CONTENT, true); + auto Token = GetBinding(RESTAPI::Protocol::TOKEN, ""); + if(Token.empty() || (Token != SessionToken_)) { + return BadRequest(RESTAPI::Errors::MissingOrInvalidParameters); } - - Logger_.information(fmt::format("BAD-LOGOUT({}): Request for {}", Request->clientAddress().toString(), UserInfo_.userinfo.email)); - NotFound(); + AuthService()->Logout(Token); + return ReturnStatus(Poco::Net::HTTPResponse::HTTP_NO_CONTENT, true); } void RESTAPI_oauth2_handler::DoPost() {