only create cookie when not existed.
All checks were successful
Deploy / Build (push) Successful in 5m29s

This commit is contained in:
amass 2025-01-02 23:02:37 +08:00
parent 1ba9de15c4
commit fe704cb359

View File

@ -95,10 +95,15 @@ void Application::authEvent() {
} }
} }
setInternalPath("/", true); setInternalPath("/", true);
auto app = Amass::Singleton<WebToolkit::Server>::instance(); auto app = Amass::Singleton<WebToolkit::Server>::instance();
auto &service = app->authService(); auto &service = app->authService();
Wt::Http::Cookie cookie(service.authTokenCookieName(), service.createAuthToken(u)); auto &env = environment();
setCookie(cookie); auto token = env.getCookie(service.authTokenCookieName());
if (token == nullptr) {
Wt::Http::Cookie cookie(service.authTokenCookieName(), service.createAuthToken(u));
setCookie(cookie);
}
} else { } else {
m_loginPage = m_navigationBar->removeLoginItem(); m_loginPage = m_navigationBar->removeLoginItem();
LOG(info) << "User logged out."; LOG(info) << "User logged out.";