implemented persistent sessions (not destroyed when broweser closed) – needs more work

Signed-off-by: Stephan Richter <s.richter@srsoftware.de>
This commit is contained in:
2024-09-18 08:38:13 +02:00
parent f0f170119b
commit 3e88c91154
5 changed files with 29 additions and 5 deletions

View File

@@ -225,7 +225,7 @@ public class UserController extends Controller {
var user = optUser.get();
users.updatePassword(user, newPass);
var session = sessions.createSession(user);
new SessionToken(session.id()).addTo(ex);
new SessionToken(session.id(),session.expiration()).addTo(ex);
return sendRedirect(ex, "/");
}
@@ -266,7 +266,7 @@ public class UserController extends Controller {
}
private boolean sendUserAndCookie(HttpExchange ex, Session session, User user) throws IOException {
new SessionToken(session.id()).addTo(ex);
new SessionToken(session.id(),session.expiration()).addTo(ex);
return sendContent(ex, user.map(false));
}