mirror of
https://github.com/Telecominfraproject/wlan-cloud-owprov.git
synced 2025-10-29 09:42:38 +00:00
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
#include "framework/AuthClient.h"
|
||||
#include "framework/MicroServiceNames.h"
|
||||
#include "framework/OpenAPIRequests.h"
|
||||
#include "framework/utils.h"
|
||||
#include "fmt/format.h"
|
||||
|
||||
namespace OpenWifi {
|
||||
@@ -46,7 +47,7 @@ namespace OpenWifi {
|
||||
}
|
||||
}
|
||||
} catch (...) {
|
||||
poco_error(Logger(),fmt::format("Failed to retrieve token={} for TID={}", SessionToken, TID));
|
||||
poco_error(Logger(),fmt::format("Failed to retrieve token={} for TID={}", Utils::SanitizeToken(SessionToken), TID));
|
||||
}
|
||||
Expired = false;
|
||||
return false;
|
||||
@@ -99,7 +100,7 @@ namespace OpenWifi {
|
||||
}
|
||||
}
|
||||
} catch (...) {
|
||||
poco_error(Logger(),fmt::format("Failed to retrieve api key={} for TID={}", SessionToken, TID));
|
||||
poco_error(Logger(),fmt::format("Failed to retrieve api key={} for TID={}", Utils::SanitizeToken(SessionToken), TID));
|
||||
}
|
||||
Expired = false;
|
||||
return false;
|
||||
|
||||
@@ -71,7 +71,6 @@ namespace OpenWifi {
|
||||
}
|
||||
Clients_.erase(Client);
|
||||
UsersConnected_ = Clients_.size();
|
||||
std::cout << "How many clients: " << Clients_.size() << std::endl;
|
||||
}
|
||||
|
||||
void UI_WebSocketClientServer::run() {
|
||||
|
||||
@@ -524,4 +524,11 @@ bool ExtractBase64CompressedData(const std::string &CompressedData,
|
||||
return std::all_of(s.begin(),s.end(),[](char c) -> bool { return isalnum(c); });
|
||||
}
|
||||
|
||||
std::string SanitizeToken(const std::string &Token) {
|
||||
if(Token.size()>8) {
|
||||
return Token.substr(0,4) + "****" + Token.substr(Token.size()-4,4);
|
||||
}
|
||||
return "*******";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -116,6 +116,8 @@ namespace OpenWifi::Utils {
|
||||
[[nodiscard]] std::string SecondsToNiceText(uint64_t Seconds);
|
||||
[[nodiscard]] bool wgets(const std::string &URL, std::string &Response);
|
||||
[[nodiscard]] bool IsAlphaNumeric(const std::string &s);
|
||||
[[nodiscard]] std::string SanitizeToken(const std::string &Token);
|
||||
|
||||
template< typename T >
|
||||
std::string int_to_hex( T i )
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user