feat: add model groups, verified registration and CNY credit grants

This commit is contained in:
wlx committed 2026-09-18 17:27:58 +08:00
1 parent f5ba6cb255
commit 7a18db2123
40 files changed
+1980 -263

No files matched your search

@@ -64,7 +64,7 @@ class AuthPostgresTest {
assertThrows(DataIntegrityViolationException.class, () -> jdbc.update("UPDATE users SET role = 'super_admin' WHERE id = ?", operatorId));
assertThrows(IllegalStateException.class, () -> auth.ensureAdmin("operator", "test-password", "Other"));
MockMvc http = MockMvcBuilders.standaloneSetup(new AuthController(auth, 168, true))
MockMvc http = MockMvcBuilders.standaloneSetup(new AuthController(auth, org.mockito.Mockito.mock(VerificationService.class), 168, true))
.setControllerAdvice(new ApiExceptionHandler()).build();
var ownerCookie = login(http, "adimin", "super_admin");
var operatorCookie = login(http, "operator", "admin");
@@ -0,0 +1,18 @@
package com.moyi.controlplane.auth;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.*;
class PasswordHasherInteropTest {
@Test
void acceptsMaintenanceScriptPbkdf2HashesIncludingUnicode() {
PasswordHasher hasher = new PasswordHasher("local-test-pepper");
// Python hashlib fixtures with salt bytes 0..15; no real credentials.
String ascii = "pbkdf2$210000$AAECAwQFBgcICQoLDA0ODw$_ZW4zVJDiheXQ51WuP_SSr_f8xjYJXBHvjkzLlPtFHo";
String unicode = "pbkdf2$210000$AAECAwQFBgcICQoLDA0ODw$qZ4RLM7vU3k0rCJtetdh8uSbnAkWbxFYR7sD4GYRmb8";
assertTrue(hasher.matches("Qa-Test42!", ascii));
assertTrue(hasher.matches("\u6d4b\u8bd5A1!", unicode));
assertFalse(hasher.matches("wrong-password", ascii));
assertFalse(new PasswordHasher("wrong-pepper").matches("Qa-Test42!", ascii));
}
}