#1031 Introduce hasSession field in datasource (#1351)

* Introduce hasSession field in datasource

That makes isLogged more consistent as it will be '1' only when the player is online.

* Fixes

* Fix unit testing

* Update config doc

* Create SessionService

* Create test for SessionService, avoid DB operations if sessions are disabled

* Cleanup: remove outdated warning for session timeout = 0
- Remove outdated warning
- Encapsulate session enabled check in SessionService

* Fix failing SessionServiceTest, add data source integration tests for session methods
This commit is contained in:
Gabriele C
2017-10-15 18:32:51 +02:00
committed by ljacqu
parent 1487fc0d9e
commit 22e95493de
19 changed files with 537 additions and 106 deletions
@@ -20,6 +20,7 @@ import fr.xephi.authme.process.SyncProcessManager;
import fr.xephi.authme.security.PasswordSecurity;
import fr.xephi.authme.service.BukkitService;
import fr.xephi.authme.service.CommonService;
import fr.xephi.authme.service.SessionService;
import fr.xephi.authme.settings.properties.DatabaseSettings;
import fr.xephi.authme.settings.properties.EmailSettings;
import fr.xephi.authme.settings.properties.HooksSettings;
@@ -69,6 +70,9 @@ public class AsynchronousLogin implements AsynchronousProcess {
@Inject
private EmailService emailService;
@Inject
private SessionService sessionService;
AsynchronousLogin() {
}
@@ -238,9 +242,10 @@ public class AsynchronousLogin implements AsynchronousProcess {
ConsoleLogger.fine(player.getName() + " logged in!");
// makes player isLoggedin via API
// makes player loggedin
playerCache.updatePlayer(auth);
dataSource.setLogged(name);
sessionService.grantSession(name);
// As the scheduling executes the Task most likely after the current
// task, we schedule it in the end