This commit is contained in:
parent
64c2450121
commit
69cecf8022
@ -16,7 +16,7 @@ DBO_INSTANTIATE_TEMPLATES(MyMessage)
|
||||
|
||||
void AuthenticationResource::handleRequest(const Wt::Http::Request &request, Wt::Http::Response &response) {
|
||||
auto tag = request.urlParam("tag");
|
||||
// LOG(info) << "path: " << request.path() << ", tag: " << tag;
|
||||
// LOG(info) << "path: " << request.path() << ", tag: " << tag << ", server: " << request.hostName();
|
||||
response.setMimeType("application/json");
|
||||
MyMessage message;
|
||||
auto app = Amass::Singleton<WebToolkit::Server>::instance();
|
||||
@ -47,8 +47,12 @@ void AuthenticationResource::handleRequest(const Wt::Http::Request &request, Wt:
|
||||
using namespace boost::beast::http;
|
||||
response.setStatus(static_cast<int>(state == Wt::Auth::AuthTokenState::Valid ? status::ok : status::unauthorized));
|
||||
} else { // logout
|
||||
response.addHeader("Set-Cookie", std::format("{}=; path={}; max-age=0; expires=Thu, 01 Jan 1970 00:00:00 GMT",
|
||||
service.authTokenCookieName(), AuthModel::CookiePath));
|
||||
auto domain = request.hostName();
|
||||
if (domain.find("amass.fun") != std::string::npos) {
|
||||
domain = AuthModel::CookieDomain;
|
||||
}
|
||||
response.addHeader("Set-Cookie", std::format("{}=; path={}; Domain={}; max-age=0; expires=Thu, 01 Jan 1970 00:00:00 GMT",
|
||||
service.authTokenCookieName(), AuthModel::CookiePath, domain));
|
||||
}
|
||||
Wt::Dbo::JsonSerializer writer(response.out());
|
||||
writer.serialize(message);
|
||||
|
Loading…
Reference in New Issue
Block a user