Migrate storage to DogeCloud and expand admin dashboard

This commit is contained in:
yoyuzh
2026-04-02 12:20:50 +08:00
parent 2424fbd2a7
commit 97edc4cc32
65 changed files with 2842 additions and 380 deletions

View File

@@ -53,7 +53,7 @@ class AuthControllerValidationTest {
"""))
.andExpect(status().isBadRequest())
.andExpect(jsonPath("$.code").value(1000))
.andExpect(jsonPath("$.msg").value("密码至少10位,且必须包含大写字母、小写字母、数字和特殊字符"));
.andExpect(jsonPath("$.msg").value("密码至少8位,且必须包含大写字母"));
}
@Test

View File

@@ -14,49 +14,34 @@ class PasswordPolicyTest {
}
@Test
void shouldRejectPasswordShorterThanTenCharacters() {
assertThat(PasswordPolicy.isStrong("Abc1!defg")).isFalse(); // 9 chars
void shouldRejectPasswordShorterThanEightCharacters() {
assertThat(PasswordPolicy.isStrong("Abcdefg")).isFalse(); // 7 chars
}
@Test
void shouldAcceptPasswordWithExactlyTenCharacters() {
assertThat(PasswordPolicy.isStrong("Abcdefg1!x")).isTrue(); // 10 chars
void shouldAcceptPasswordWithExactlyEightCharacters() {
assertThat(PasswordPolicy.isStrong("Abcdefgh")).isTrue(); // 8 chars
}
@Test
void shouldRejectPasswordMissingUppercase() {
assertThat(PasswordPolicy.isStrong("abcdefg1!x")).isFalse();
assertThat(PasswordPolicy.isStrong("abcdefgh")).isFalse();
}
@Test
void shouldRejectPasswordMissingLowercase() {
assertThat(PasswordPolicy.isStrong("ABCDEFG1!X")).isFalse();
}
@Test
void shouldRejectPasswordMissingDigit() {
assertThat(PasswordPolicy.isStrong("Abcdefgh!x")).isFalse();
}
@Test
void shouldRejectPasswordMissingSpecialCharacter() {
assertThat(PasswordPolicy.isStrong("Abcdefg12x")).isFalse();
}
@Test
void shouldAcceptStrongPasswordWithAllRequirements() {
assertThat(PasswordPolicy.isStrong("MyP@ssw0rd!")).isTrue();
void shouldAcceptPasswordThatOnlyNeedsUppercaseAndLength() {
assertThat(PasswordPolicy.isStrong("ABCDEFGH")).isTrue();
}
@ParameterizedTest
@ValueSource(strings = {"", "short", "nouppercase1!", "NOLOWERCASE1!", "NoSpecialChar1", "NoDigit!AbcXyz"})
@ValueSource(strings = {"", "short", "noupper", "abcdefghi"})
void shouldRejectWeakPasswords(String password) {
assertThat(PasswordPolicy.isStrong(password)).isFalse();
}
@Test
void shouldAcceptLongPasswordWithAllRequirements() {
assertThat(PasswordPolicy.isStrong("MyV3ryStr0ng&SecureP@ssword2024!")).isTrue();
void shouldAcceptLongPasswordWithUppercase() {
assertThat(PasswordPolicy.isStrong("MyVerySimplePassword")).isTrue();
}
@Test

View File

@@ -26,7 +26,7 @@ class RegisterRequestValidationTest {
assertThat(violations)
.extracting(violation -> violation.getMessage())
.contains("密码至少10位,且必须包含大写字母、小写字母、数字和特殊字符");
.contains("密码至少8位,且必须包含大写字母");
}
@Test
@@ -35,8 +35,8 @@ class RegisterRequestValidationTest {
"alice",
"alice@example.com",
"13800138000",
"StrongPass1!",
"StrongPass1!",
"Abcdefgh",
"Abcdefgh",
"invite-code"
);