feat(users): reject blank email in updateProfile and adminUpdateUser
Previously a blank email string would silently set email to null, which would cause a DB constraint violation after V44 migration. Now throws DomainException.badRequest instead. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -103,8 +103,8 @@ public class UserService {
|
||||
}
|
||||
});
|
||||
user.setEmail(dto.getEmail().trim());
|
||||
} else if (dto.getEmail() != null && dto.getEmail().isBlank()) {
|
||||
user.setEmail(null);
|
||||
} else if (dto.getEmail() != null) {
|
||||
throw DomainException.badRequest(ErrorCode.VALIDATION_ERROR, "Email must not be blank");
|
||||
}
|
||||
|
||||
user.setFirstName(dto.getFirstName());
|
||||
@@ -126,8 +126,8 @@ public class UserService {
|
||||
}
|
||||
});
|
||||
user.setEmail(dto.getEmail().trim());
|
||||
} else if (dto.getEmail() != null && dto.getEmail().isBlank()) {
|
||||
user.setEmail(null);
|
||||
} else if (dto.getEmail() != null) {
|
||||
throw DomainException.badRequest(ErrorCode.VALIDATION_ERROR, "Email must not be blank");
|
||||
}
|
||||
|
||||
user.setFirstName(dto.getFirstName());
|
||||
|
||||
Reference in New Issue
Block a user