Change log level to DEBUG in beta configuration and improve logging in LoginController.

This commit is contained in:
akastijn 2025-07-06 19:23:38 +02:00
parent 42f0961f13
commit aef32a8982
2 changed files with 4 additions and 1 deletions

View File

@ -84,11 +84,13 @@ public class LoginController implements LoginApi {
@Override @Override
public ResponseEntity<String> login(String code) { public ResponseEntity<String> login(String code) {
if (code == null) { if (code == null) {
log.warn("Received null login code");
return ResponseEntity.badRequest().build(); return ResponseEntity.badRequest().build();
} }
CacheEntry cacheEntry = cache.get(code); CacheEntry cacheEntry = cache.get(code);
if (cacheEntry == null || cacheEntry.expiry().isBefore(Instant.now())) { if (cacheEntry == null || cacheEntry.expiry().isBefore(Instant.now())) {
log.warn("Received invalid login code {}", code);
return ResponseEntity.status(HttpStatus.FORBIDDEN).build(); return ResponseEntity.status(HttpStatus.FORBIDDEN).build();
} }
@ -96,6 +98,7 @@ public class LoginController implements LoginApi {
cache.remove(code); cache.remove(code);
log.debug("Generated token for user {}", cacheEntry.uuid);
return ResponseEntity.ok(token); return ResponseEntity.ok(token);
} }

View File

@ -5,4 +5,4 @@ database.host=${DB_HOST:localhost}
database.user=${DB_USER:root} database.user=${DB_USER:root}
database.password=${DB_PASSWORD:root} database.password=${DB_PASSWORD:root}
cors.allowed-origins=${CORS:https://beta.alttd.com} cors.allowed-origins=${CORS:https://beta.alttd.com}
logging.level.com.alttd.altitudeweb=INFO logging.level.com.alttd.altitudeweb=DEBUG