return MHD_YES;
}
- auth_logout(as->username);
-
- return respond_JSON_Success(connection);
+ const char *given_token = MHD_lookup_connection_value(connection, MHD_COOKIE_KIND, "auth");
+ if (given_token != NULL && auth_check_token(as->username, given_token)) {
+ auth_logout(as->username);
+ return respond_JSON_Success(connection);
+ } else {
+ return respond_JSON_Failure(connection);
+ }
} else {
return respond_404(connection);
}