Log in through AccountService

This commit is contained in:
P0nk
2024-09-28 18:30:41 +02:00
parent 1be775394e
commit 5595f5763b
6 changed files with 62 additions and 72 deletions

View File

@@ -213,6 +213,18 @@ public class AccountService {
return accountRepository.setChrSlots(accountId, chrSlots);
}
public boolean logIn(Client c) {
byte newState = LoginState.LOGGED_IN;
if (c.getLoginState() != LoginState.NOT_LOGGED_IN) {
return false;
}
setLoginStateMysql(c.getAccID(), newState);
setLoginStatePostgres(c.getAccID(), newState);
c.setLoginState(newState);
return true;
}
public void logOut(Client c) {
SessionCoordinator.getInstance().closeSession(c, false);
byte newState = LoginState.NOT_LOGGED_IN;