Revize 2e85bd2f
Přidáno uživatelem Jakub Šmíd před více než 2 roky(ů)
backend/src/main/java/cz/zcu/kiv/backendapi/user/UserDto.java | ||
---|---|---|
2 | 2 |
|
3 | 3 |
import cz.zcu.kiv.backendapi.user.password.PasswordDto; |
4 | 4 |
import cz.zcu.kiv.backendapi.user.permission.PermissionDto; |
5 |
import cz.zcu.kiv.backendapi.validation.PasswordMatches; |
|
6 | 5 |
import cz.zcu.kiv.backendapi.validation.ValidEmail; |
7 | 6 |
import lombok.AllArgsConstructor; |
8 | 7 |
import lombok.Data; |
... | ... | |
19 | 18 |
@Data |
20 | 19 |
@NoArgsConstructor |
21 | 20 |
@AllArgsConstructor |
22 |
@PasswordMatches |
|
23 | 21 |
public class UserDto { |
24 | 22 |
/** |
25 | 23 |
* Name |
... | ... | |
46 | 44 |
*/ |
47 | 45 |
@Valid |
48 | 46 |
@NotNull(message = "Passwords must not be null") |
49 |
@NotEmpty(message = "Passwords must not be empty") |
|
50 | 47 |
private PasswordDto passwords; |
51 |
|
|
52 |
|
|
53 | 48 |
} |
backend/src/main/java/cz/zcu/kiv/backendapi/validation/PasswordMatchesValidator.java | ||
---|---|---|
18 | 18 |
* @return true if passwords matches, false otherwise |
19 | 19 |
*/ |
20 | 20 |
@Override |
21 |
public boolean isValid(final PasswordDto passwordDto, final ConstraintValidatorContext constraintValidatorContext) {
|
|
21 |
public boolean isValid(PasswordDto passwordDto, ConstraintValidatorContext constraintValidatorContext) {
|
|
22 | 22 |
if (passwordDto.getPassword() == null || passwordDto.getConfirmationPassword() == null) { |
23 | 23 |
return false; |
24 | 24 |
} |
Také k dispozici: Unified diff
Fixed user registration bad constraint
re #9620