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

View File

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