fix: browser context on password-change history, plain settings errors, New password label

Found in the browser check: change-password history rows had no browser
or IP, settings errors named internal fields, and the dialog's new
password field read just "Password".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EFUzfj5akPxyikzGc2iAHM
This commit is contained in:
ngqileandClaude Opus 5.5 committed 2026-11-30 14:52:15 +08:00
1 parent 091503a820
commit dd9bbbe036
10 files changed
+69 -10

No files matched your search

@@ -118,9 +118,9 @@ public class LoginSecurityService {
@Transactional
public Config saveConfig(Config c) {
if (c == null) throw new IllegalArgumentException("body is required");
if (c.maxAttempts() < 1) throw new IllegalArgumentException("maxAttempts must be at least 1");
if (c.period() < 1) throw new IllegalArgumentException("period must be at least 1");
if (c.chronoUnit() == null) throw new IllegalArgumentException("unit must be S, M, H or D");
if (c.maxAttempts() < 1) throw new IllegalArgumentException("Max attempts must be at least 1");
if (c.period() < 1) throw new IllegalArgumentException("Period must be at least 1");
if (c.chronoUnit() == null) throw new IllegalArgumentException("Unit must be seconds, minutes, hours or days");
put(BLOCK, PERIOD_PARAM, c.enabled() ? "Y" : "N", String.valueOf(c.period()));
put(BLOCK, MAX_PARAM, null, String.valueOf(c.maxAttempts()));
put(UNIT, "ADMIN_LOGIN_BLOCK_TIME_UNIT", null, c.unit());
@@ -138,13 +138,13 @@ public class LoginSecurityService {
List<PasswordRuleProperty> rows = new ArrayList<>();
for (Rule in : input) { // validate everything before saving anything
if (in == null) throw new IllegalArgumentException("rule is required");
if (!"Y".equals(in.status()) && !"N".equals(in.status())) throw new IllegalArgumentException("status must be Y or N");
if (!"Y".equals(in.status()) && !"N".equals(in.status())) throw new IllegalArgumentException("Each rule must be on or off");
if (in.id() == null) throw new IllegalArgumentException("id is required");
PasswordRuleProperty row = properties.findById(in.id()).filter(r -> PWD.equals(r.getType()))
.orElseThrow(() -> new IllegalArgumentException("unknown password rule " + in.id()));
String p = row.getParam();
if (in.value() != null && p != null && (p.endsWith("_MIN") || p.endsWith("_MAX")) && !in.value().matches("\\d{1,9}"))
throw new IllegalArgumentException(p + " must be a non-negative integer");
throw new IllegalArgumentException("Rule values must be whole numbers");
rows.add(row);
}
for (int i = 0; i < rows.size(); i++) {