This commit is contained in:
2026-04-18 13:34:20 +03:00
parent 7cc1ff9555
commit 0bca35d015
2 changed files with 0 additions and 8 deletions

View File

@@ -24,10 +24,8 @@ public class AuthHandler {
userService.findByLoginOrEmail(login).onComplete(ar -> { userService.findByLoginOrEmail(login).onComplete(ar -> {
if (ar.succeeded() && ar.result() != null) { if (ar.succeeded() && ar.result() != null) {
JsonObject user = ar.result(); JsonObject user = ar.result();
System.out.println("User found: " + user.encode());
boolean passwordOk = userService.checkPassword(password, user.getString("password")); boolean passwordOk = userService.checkPassword(password, user.getString("password"));
System.out.println("Password OK: " + passwordOk);
if (passwordOk) { if (passwordOk) {
// Надёжное получение флага активности // Надёжное получение флага активности
@@ -37,10 +35,8 @@ public class AuthHandler {
Integer activeInt = user.getInteger("active"); Integer activeInt = user.getInteger("active");
active = activeInt != null && activeInt == 1; active = activeInt != null && activeInt == 1;
} }
System.out.println("Active flag: " + active);
if (!active) { if (!active) {
System.out.println("Sending: Account not activated");
ctx.response().setStatusCode(401).end("Account not activated"); ctx.response().setStatusCode(401).end("Account not activated");
return; return;
} }
@@ -50,11 +46,9 @@ public class AuthHandler {
session.put("login", user.getString("login")); session.put("login", user.getString("login"));
ctx.response().end(new JsonObject().put("success", true).put("login", user.getString("login")).encode()); ctx.response().end(new JsonObject().put("success", true).put("login", user.getString("login")).encode());
} else { } else {
System.out.println("Sending: Invalid credentials (password mismatch)");
ctx.response().setStatusCode(401).end("Invalid credentials"); ctx.response().setStatusCode(401).end("Invalid credentials");
} }
} else { } else {
System.out.println("Sending: Invalid credentials (user not found or error)");
ctx.response().setStatusCode(401).end("Invalid credentials"); ctx.response().setStatusCode(401).end("Invalid credentials");
} }
}); });

View File

@@ -73,11 +73,9 @@ public class UserService {
.execute(Tuple.of(loginOrEmail, loginOrEmail)) .execute(Tuple.of(loginOrEmail, loginOrEmail))
.map(rows -> { .map(rows -> {
if (rows.size() == 0) { if (rows.size() == 0) {
System.out.println("User not found: " + loginOrEmail);
return null; return null;
} }
Row row = rows.iterator().next(); Row row = rows.iterator().next();
System.out.println("User found, active=" + row.getBoolean("active"));
return toJson(row); return toJson(row);
}); });
} }